diff --git a/changes.txt b/changes.txt index 9f7684f8d..4f248a132 100644 --- a/changes.txt +++ b/changes.txt @@ -21,6 +21,7 @@ Released: N/A * Fixed the default shader improperly applying gamma correction to per-vertex colors when gamma correction is requested but not supported on OpenGL ES. * Fixed text coloring breaking because of an empty string. * Fixed large burst of particles when dramatically increasing the emission rate of a ParticleSystem. + * Fixed MouseJoint:getBodies unconditionally erroring. * Improved performance of Channel methods by roughly 2x in many cases. diff --git a/src/modules/physics/box2d/Joint.h b/src/modules/physics/box2d/Joint.h index dd6be8e1c..258234985 100644 --- a/src/modules/physics/box2d/Joint.h +++ b/src/modules/physics/box2d/Joint.h @@ -84,8 +84,8 @@ public: **/ Type getType() const; - Body *getBodyA() const; - Body *getBodyB() const; + virtual Body *getBodyA() const; + virtual Body *getBodyB() const; /** * Gets the anchor positions of the Joint in world diff --git a/src/modules/physics/box2d/MouseJoint.cpp b/src/modules/physics/box2d/MouseJoint.cpp index b037a9c79..08e41d35e 100644 --- a/src/modules/physics/box2d/MouseJoint.cpp +++ b/src/modules/physics/box2d/MouseJoint.cpp @@ -91,6 +91,16 @@ float MouseJoint::getDampingRatio() const return joint->GetDampingRatio(); } +Body *MouseJoint::getBodyA() const +{ + return Joint::getBodyB(); +} + +Body *MouseJoint::getBodyB() const +{ + return nullptr; +} + } // box2d } // physics } // love diff --git a/src/modules/physics/box2d/MouseJoint.h b/src/modules/physics/box2d/MouseJoint.h index 803bf4b94..bf365e8d2 100644 --- a/src/modules/physics/box2d/MouseJoint.h +++ b/src/modules/physics/box2d/MouseJoint.h @@ -95,6 +95,9 @@ public: **/ float getDampingRatio() const; + virtual Body *getBodyA() const; + virtual Body *getBodyB() const; + private: // The Box2D MouseJoint object. b2MouseJoint *joint;