浏览代码

Added BroadPhaseCastResult::Reset

Jorrit Rouwe 1 年之前
父节点
当前提交
733af81024
共有 1 个文件被更改,包括 3 次插入0 次删除
  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.
 	/// 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; }
 	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
 	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)
 	float			mFraction = 1.0f + FLT_EPSILON;		///< Hit fraction of the ray/object [0, 1], HitPoint = Start + mFraction * (End - Start)
 };
 };