禁用碰撞完全AndEngine Box2D的一个机构 [英] Disable collision completely of a body in AndEngine Box2D

查看:152
本文介绍了禁用碰撞完全AndEngine Box2D的一个机构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个泡泡射击类型的游戏,我想一个机构不与任何东西发生碰撞时,其他的爆裂或跌落。
我不能使用碰撞过滤,因为所有在现场的尸体是同一类型。
我想禁用碰撞。我不希望发生冲突的机构与任何其他body.Some人告诉我到isSensor标志设置为true,但我再次无法取得该标志,并设置它。
请帮助。

I am working on a Bubble Shooter type game where I want a body not to collide with any thing else when its burst or falling down. I cant use collision filtering because all the bodies on the scene are of same type. I want to disable the collision. I don't want to collide a body with any other body.Some one told me to set the isSensor flag to true but again I am not able to get the flag and set it. Please help.

推荐答案

找到了答案:

for(int i=0; i<getBody().getFixtureList().size();i++){
        this.getBody().getFixtureList().get(i).setSensor(true);
    }

传感器设置为true,将导致身体没有冲突的影响。但要记住真正的冲突正在发生和接触听众被调用。但由于物理碰撞效果没有发生,所以你需要检查,如果身体有设置为true isSesors无可奈何接触听众。

Setting the sensor to true will cause no collisions effects for a body. But remember actually collisions are occurring and contact listeners are called. But collision effect due to physics is not happening so you need to check that if the body has isSesors set to true do nothing in contact listeners.

这篇关于禁用碰撞完全AndEngine Box2D的一个机构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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