使用花栗鼠的iPhone碰撞检测问题

发布于 2024-07-25 15:38:45 字数 408 浏览 11 评论 0原文

我有两个小问题: 花栗鼠碰撞检测:我正在开发一个游戏,可以检测球和一些静态多边形形状之间的碰撞。 这是有效的,但“部分”有效,这意味着它适用于大约 5 个游戏场景(例如 1 - 5 级),但适用于第 6 个场景,但在第 7 个场景中一切正常,等等。 基本上,碰撞检测正在工作,但有时会失败。

我认为这不是设置空间、主体等的问题。因为一切都工作正常一段时间,并且错误仅在一系列“正确场景”之后发生一次。 起初,我认为问题是我在场景结束后没有从空间中移除形状和物体,但从空间中移除物体和形状后问题仍然存在。

cocos2d:对于cocos2d,我的印象是加速计激活有时会失败。

有人遇到过这些问题吗? 欢迎任何建议,谢谢。

帖子:1 加入时间:2009 年 6 月 24 日星期三下午 2:34

I have 2 slight problems :
chipmunk collision detection : i'm developping a game where i detect collisions between a ball and some static polygon shapes.
this is working but "partially", meaning that it works for around 5 game scenes (level 1 - 5 , for ex.) but fails for the 6th one, and then on the 7th scene everything works ok etc..
basically, the collision detection is working but fails at times..

I don't think its a problem with setting spaces, bodies etc.. because everything works ok for a while and the error only occurs once after a series of "correct scenes".
At 1st i thought the problem was my not removing shapes and bodies from the space after a scene is over, but the problem still continues after removed the bodies and shapes from the space.

cocos2d : as for cocos2d, i have the impression that the accelerometer activation fails at times.

has anyone come across any of these problems? any suggestions are welcome, thanks.

Posts: 1
Joined: Wed Jun 24, 2009 2:34 pm

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千纸鹤带着心事 2024-08-01 15:38:45

您只使用花栗鼠进行碰撞检测吗?

如果是这样,那就不要。 只需定义两个形状之间的碰撞(假设多边形相似)。 这是两个圆的示例:
http://kwigbo.com/wp /2009/03/04/cocos2d-circle-to-circle-collision-detection/

在我自己的游戏中,我通过检查数组对象并查看它们是否在一定范围内来定义两个矩形精灵之间的碰撞在我的英雄的两侧,并且与顶部或底部也有一定的距离。 为一个时髦的形状做这个会很棘手,但值得。

Are you only using chipmunk for collision detection?

If so, don't. Just define the collision between the two shapes (assuming the polygons are similar). Here is an example for two circles:
http://kwigbo.com/wp/2009/03/04/cocos2d-circle-to-circle-collision-detection/

In my own game I defined a collision between two rectangular sprites by checking through the array objects and seeing if they were withing a certain range on either side of my hero, and also a certain distance with the top or bottom. Doing this for a funky shape would be tricky, but worth it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文