Skip to content

Commit

Permalink
Added PlaneShape::GetMaterial/SetMaterial
Browse files Browse the repository at this point in the history
  • Loading branch information
jrouwe committed Dec 29, 2024
1 parent 2a28ecc commit 18bb698
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Jolt/Physics/Collision/Shape/PlaneShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class JPH_EXPORT PlaneShape final : public Shape
virtual MassProperties GetMassProperties() const override;

// 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
virtual Vec3 GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg inLocalSurfacePosition) const override { JPH_ASSERT(inSubShapeID.IsEmpty(), "Invalid subshape ID"); return mPlane.GetNormal(); }
Expand Down Expand Up @@ -114,6 +114,10 @@ class JPH_EXPORT PlaneShape final : public Shape
// See Shape::GetVolume
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
static void sRegister();

Expand Down

0 comments on commit 18bb698

Please sign in to comment.