通过关节连接的体必须被添加到同一个CCPhysicsNode,但是两个体在同一个CCPhysicsNode下,但是 [英] Bodies connected by a joint must be added to the same CCPhysicsNode, however two bodies are under the same CCPhysicsNode but

查看:244
本文介绍了通过关节连接的体必须被添加到同一个CCPhysicsNode,但是两个体在同一个CCPhysicsNode下,但是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本教程中提出申请。

I am making application by this tutorial.

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

我直接在这样的代码中创建了jointnode

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];

,但即使确定两个节点在同一CCPhysicNode下,

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

它显示此错误

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

有没有人有这个问题?

img src =https://i.stack.imgur.com/75RWR.pngalt =enter image description here>

推荐答案

我有同样的问题,结果是我没有启用物理在_mouseNode。在节点上启用物理解决了问题。

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

这篇关于通过关节连接的体必须被添加到同一个CCPhysicsNode,但是两个体在同一个CCPhysicsNode下,但是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆