whitebear
whitebear

Reputation: 12433

Bodies connected by a joint must be added to the same CCPhysicsNode, however two bodies are under the same CCPhysicsNode but

I am making application by this tutorial.

https://www.makegameswith.us/tutorials/getting-started-with-spritebuilder/spritebuilder-physics/

I made jointnode directly in code like this

_mouseJoint = [CCPhysicsJoint connectedSpringJointWithBodyA:_mouseJointNode.physicsBody bodyB:_catapultArm.physicsBody anchorA:ccp(0, 0) anchorB:ccp(34, 138) restLength:0.f stiffness:3000.f damping:150.f];

but even though surely two nodes are under the same CCPhysicNode,

it shows this error

Bodies connected by a joint must be added to the same CCPhysicsNode,

Does anyone have same issue as this?

enter image description here

enter image description here

Upvotes: 0

Views: 404

Answers (1)

Jader Feijo
Jader Feijo

Reputation: 1209

I had the same problem, it turns out I had not enabled physics on the _mouseNode. Enabling physics on the node solved the problem.

Upvotes: 3

Related Questions