Prevent attaching a MouseJoint to a kinematic body (fixes #1185)

It turns out, calling World:update() after attaching a MouseJoint to a
kinematic body causes an exception. Normally the wrapper catches the exception,
but somehow this exception cannot be caught. Wonderful.
This commit is contained in:
Bart van Strien
2016-08-02 14:26:51 +02:00
parent 0ce44e465d
commit 57e4ec78e3
+3
View File
@@ -36,6 +36,9 @@ MouseJoint::MouseJoint(Body *body1, float x, float y)
: Joint(body1)
, joint(NULL)
{
if (body1->getType() == Body::BODY_KINEMATIC)
throw love::Exception("Cannot attach a MouseJoint to a kinematic body");
b2MouseJointDef def;
def.bodyA = body1->world->getGroundBody();