Browse Source

Added PlaneShape::GetMaterial/SetMaterial

See: https://github.com/godotengine/godot/pull/100748
Jorrit Rouwe 7 months ago
parent
commit
18bb698570
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Jolt/Physics/Collision/Shape/PlaneShape.h

+ 5 - 1
Jolt/Physics/Collision/Shape/PlaneShape.h

@@ -71,7 +71,7 @@ public:
 	virtual MassProperties			GetMassProperties() const override;
 	virtual MassProperties			GetMassProperties() const override;
 
 
 	// See Shape::GetMaterial
 	// See Shape::GetMaterial
-	virtual const PhysicsMaterial *	GetMaterial(const SubShapeID &inSubShapeID) const override	{ JPH_ASSERT(inSubShapeID.IsEmpty(), "Invalid subshape ID"); return mMaterial != nullptr? mMaterial : PhysicsMaterial::sDefault; }
+	virtual const PhysicsMaterial *	GetMaterial(const SubShapeID &inSubShapeID) const override	{ JPH_ASSERT(inSubShapeID.IsEmpty(), "Invalid subshape ID"); return GetMaterial(); }
 
 
 	// See Shape::GetSurfaceNormal
 	// See Shape::GetSurfaceNormal
 	virtual Vec3					GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg inLocalSurfacePosition) const override { JPH_ASSERT(inSubShapeID.IsEmpty(), "Invalid subshape ID"); return mPlane.GetNormal(); }
 	virtual Vec3					GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg inLocalSurfacePosition) const override { JPH_ASSERT(inSubShapeID.IsEmpty(), "Invalid subshape ID"); return mPlane.GetNormal(); }
@@ -114,6 +114,10 @@ public:
 	// See Shape::GetVolume
 	// See Shape::GetVolume
 	virtual float					GetVolume() const override									{ return 0; }
 	virtual float					GetVolume() const override									{ return 0; }
 
 
+	/// Material of the shape
+	void							SetMaterial(const PhysicsMaterial *inMaterial)				{ mMaterial = inMaterial; }
+	const PhysicsMaterial *			GetMaterial() const											{ return mMaterial != nullptr? mMaterial : PhysicsMaterial::sDefault; }
+
 	// Register shape functions with the registry
 	// Register shape functions with the registry
 	static void						sRegister();
 	static void						sRegister();