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

家住魔仙堡 提交于 2019-12-13 02:47:31

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/24364897/bodies-connected-by-a-joint-must-be-added-to-the-same-ccphysicsnode-however-two

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!