花栗鼠对速度的条件碰撞?
我正在用 cocos2d 做一个游戏,并使用花栗鼠来管理物理。我想要实现的是,几乎每个任天堂游戏都会做的事情是,只要速度为正,您的角色就可以跳跃并在较高的楼层(碰撞形状)中休息,而不会引起碰撞,而一旦速度为负,碰撞就会发生。确实发生了。
基本上我想根据速度值调节两个形状之间的碰撞。谁能指出我如何实现这一点的正确方向?谢谢。
-奥斯卡
I am doing a game with cocos2d and using chipmunk to manage the physics. What I would like to achieve is what pretty much every nintendo game does that your character may jump and rest in a higher floor (collision shape) without causing a collision as long as the velocity is positive, and that once the velocity is negative the collision does happen.
Basically I want to condition the collision between 2 shapes based on the velocity value. Could anyone please point me in the right direction on how to implement this?. Thank you.
-Oscar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Chipmunk 的最新版本对碰撞事件有更好的支持,并且有一个简单的演示,展示了如何实现单向平台。
The latest version of Chipmunk has better support for collision events and has a simple demo showing how to implement one way platforms.
我只需实现每像素碰撞检测 正常,但添加附加条件:如果速度有向上分量,则忽略碰撞。
I'd just implement per-pixel collision-detection as normal, but add your additional condition: if the velocity has a upward component, ignore the collision.