Skip to content

Commit 18bb698

Browse files
committed
Added PlaneShape::GetMaterial/SetMaterial
See: godotengine/godot#100748
1 parent 2a28ecc commit 18bb698

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Jolt/Physics/Collision/Shape/PlaneShape.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class JPH_EXPORT PlaneShape final : public Shape
7171
virtual MassProperties GetMassProperties() const override;
7272

7373
// See Shape::GetMaterial
74-
virtual const PhysicsMaterial * GetMaterial(const SubShapeID &inSubShapeID) const override { JPH_ASSERT(inSubShapeID.IsEmpty(), "Invalid subshape ID"); return mMaterial != nullptr? mMaterial : PhysicsMaterial::sDefault; }
74+
virtual const PhysicsMaterial * GetMaterial(const SubShapeID &inSubShapeID) const override { JPH_ASSERT(inSubShapeID.IsEmpty(), "Invalid subshape ID"); return GetMaterial(); }
7575

7676
// See Shape::GetSurfaceNormal
7777
virtual Vec3 GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg inLocalSurfacePosition) const override { JPH_ASSERT(inSubShapeID.IsEmpty(), "Invalid subshape ID"); return mPlane.GetNormal(); }
@@ -114,6 +114,10 @@ class JPH_EXPORT PlaneShape final : public Shape
114114
// See Shape::GetVolume
115115
virtual float GetVolume() const override { return 0; }
116116

117+
/// Material of the shape
118+
void SetMaterial(const PhysicsMaterial *inMaterial) { mMaterial = inMaterial; }
119+
const PhysicsMaterial * GetMaterial() const { return mMaterial != nullptr? mMaterial : PhysicsMaterial::sDefault; }
120+
117121
// Register shape functions with the registry
118122
static void sRegister();
119123

0 commit comments

Comments
 (0)