花栗鼠的身体随着视差移动?
我正在使用 Cocos2D、SpaceManager 和 Chipmunk。我有一个有 4 层的视差节点,它与可玩花栗鼠身体的位置相关。该物体需要与视差层之一上的静态物体发生碰撞,静态物体必须从屏幕开始,然后移入屏幕并发生碰撞。
我知道你不应该用花栗鼠来移动静态物体,除非你重新进行。然而,每秒重新哈希 60 次以跟上帧速率似乎很混乱。谁能想到另一种方法来做到这一点?
干杯。
I'm using Cocos2D, SpaceManager and Chipmunk. I have a parallax node with 4 layers on it, this is tied to the location of a playable chipmunk body. This body needs to collide with static objects on one of the parallax layers, the static bodies must start off screen then move into screen and collide.
I know you are not supposed to move static bodies with Chipmunk, unless you rehash. However, rehashing 60 time a second to keep up with the framerate seems messy. Can anyone think of an alternate way to do this?
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试的一件事是使用刚性关节将每个视差层中的所有对象连接到非碰撞体。然后沿着视差层移动该主体以拖动对象。但这可能不是最好的方法。
One thing you could try is joining all the objects in each parallax layer to a non-colliding body using rigid joints. Then move that body along with the parallax layer to drag the objects along. THis may not be the best method, though.