Browse Source

Added additional getters to TaperedCapsuleShape and TriangleShape

Jorrit Rouwe 11 months ago
parent
commit
5da6ac8bad

+ 9 - 0
Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h

@@ -46,6 +46,15 @@ public:
 							TaperedCapsuleShape() : ConvexShape(EShapeSubType::TaperedCapsule) { }
 							TaperedCapsuleShape(const TaperedCapsuleShapeSettings &inSettings, ShapeResult &outResult);
 
+	/// Get top radius of the tapered capsule
+	inline float			GetTopRadius() const													{ return mTopRadius; }
+
+	/// Get bottom radius of the tapered capsule
+	inline float			GetBottomRadius() const													{ return mBottomRadius; }
+
+	/// Get half height between the top and bottom sphere center
+	inline float			GetHalfHeight() const													{ return 0.5f * (mTopCenter - mBottomCenter); }
+
 	// See Shape::GetCenterOfMass
 	virtual Vec3			GetCenterOfMass() const override										{ return mCenterOfMass; }
 

+ 5 - 0
Jolt/Physics/Collision/Shape/TriangleShape.h

@@ -44,6 +44,11 @@ public:
 	/// Note that the convex radius is currently only used for shape vs shape collision, for all other purposes the triangle is infinitely thin.
 							TriangleShape(Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3, float inConvexRadius = 0.0f, const PhysicsMaterial *inMaterial = nullptr) : ConvexShape(EShapeSubType::Triangle, inMaterial), mV1(inV1), mV2(inV2), mV3(inV3), mConvexRadius(inConvexRadius) { JPH_ASSERT(inConvexRadius >= 0.0f); }
 
+	/// Get the vertices of the triangle
+	inline Vec3				GetVertex1() const																	{ return mV1; }
+	inline Vec3				GetVertex2() const																	{ return mV2; }
+	inline Vec3				GetVertex3() const																	{ return mV3; }
+
 	/// Convex radius
 	float					GetConvexRadius() const																{ return mConvexRadius; }