summaryrefslogtreecommitdiffstats
path: root/source/Tracer.h
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2013-11-05 22:01:51 +0100
committerSamuel Barney <samjbarney@gmail.com>2013-11-05 22:01:51 +0100
commit9d5d74d826ceaa227c3d1684dde0743c08ae1175 (patch)
treea201eed8386f607f26e2cb9b51959368d7c63fdd /source/Tracer.h
parentMoved cTracer::SetValues to be an internal function because it is only ever used in cTracer::Trace. (diff)
downloadcuberite-9d5d74d826ceaa227c3d1684dde0743c08ae1175.tar
cuberite-9d5d74d826ceaa227c3d1684dde0743c08ae1175.tar.gz
cuberite-9d5d74d826ceaa227c3d1684dde0743c08ae1175.tar.bz2
cuberite-9d5d74d826ceaa227c3d1684dde0743c08ae1175.tar.lz
cuberite-9d5d74d826ceaa227c3d1684dde0743c08ae1175.tar.xz
cuberite-9d5d74d826ceaa227c3d1684dde0743c08ae1175.tar.zst
cuberite-9d5d74d826ceaa227c3d1684dde0743c08ae1175.zip
Diffstat (limited to 'source/Tracer.h')
-rw-r--r--source/Tracer.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/Tracer.h b/source/Tracer.h
index a4e2d352e..85cb406c8 100644
--- a/source/Tracer.h
+++ b/source/Tracer.h
@@ -13,8 +13,8 @@ public: // tolua_export
cTracer( cWorld* a_World); // tolua_export
~cTracer(); // tolua_export
- /// Determines if a collision occures along a line.
- int Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int a_Distance ); // tolua_export
+ /// Determines if a collision occures along a line. Returns true if a collision occurs.
+ bool Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int a_Distance); // tolua_export
/// Contains the position of the block that caused the collision
Vector3f BlockHitPosition; // tolua_export
@@ -26,13 +26,18 @@ public: // tolua_export
Vector3f RealHit; // tolua_export
private:
- /// Preps Tracer object for call of Trace function. Only used internally
+ /// Preps Tracer object for call of Trace function. Only used internally.
void SetValues( const Vector3f & a_Start, const Vector3f & a_Direction );
/// Calculates where on the block a collision occured, if it does occur
+ /// Returns 0 if no intersection occured
+ /// Returns 1 if an intersection occured at a single point
+ /// Returns 2 if the line segment lies in the plane being checked
int intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f & a_End, const Vector3f & a_PlanePos, const Vector3f & a_PlaneNormal );
/// Determines which face on the block a collision occured, if it does occur
+ /// Returns 0 if the block is air, water or no collision occured
+ /// Return 1 through 6 for the following block faces, repectively: -x, -z, x, z, y, -y
int GetHitNormal( const Vector3f & start, const Vector3f & end, const Vector3i & a_BlockPos);
float SigNum( float a_Num );