Browse Source

Added BroadPhaseCastResult::Reset

Jorrit Rouwe 1 year ago
parent
commit
733af81024
1 changed files with 3 additions and 0 deletions
  1. 3 0
      Jolt/Physics/Collision/CastResult.h

+ 3 - 0
Jolt/Physics/Collision/CastResult.h

@@ -18,6 +18,9 @@ public:
 	/// Function required by the CollisionCollector. A smaller fraction is considered to be a 'better hit'. For rays/cast shapes we can just use the collision fraction.
 	inline float	GetEarlyOutFraction() const			{ return mFraction; }
 
+	/// Reset this result so it can be reused for a new cast.
+	inline void		Reset()								{ mBodyID = BodyID(); mFraction = 1.0f + FLT_EPSILON; }
+
 	BodyID			mBodyID;							///< Body that was hit
 	float			mFraction = 1.0f + FLT_EPSILON;		///< Hit fraction of the ray/object [0, 1], HitPoint = Start + mFraction * (End - Start)
 };