body.isBullet does not work?

I am using body.isBullet on a moving object that is suppose to collide with other solid objects. But when it goes somewhat fast, it simply passes through the object. The documentation:
http://developer.anscamobile.com/reference/index/bodyisbullet
but it prevents fast-moving objects from passing through solid barriers.
States this is suppose to prevent that.

But it doesn’t. Why?

You can also load up this game demo from Ansca which uses isBullet:
http://blog.anscamobile.com/2010/12/ghosts-vs-monsters-open-source-game-in-corona-sdk/

And sling the object fast, it’ll still pass through walls. That game is from Ansca and yet isBullet still does not work, even though it’s in the code. That game is open-source too, for those looking for the code used. [import]uid: 145877 topic_id: 26556 reply_id: 326556[/import]

While “.isBullet” is meant to prevent MOST fast-moving objects from passing through solid objects, it can’t prevent everything. Corona uses frame-based physics. So imagine you have a solid wall in the middle of the screen. And your “bullet” is somewhere to the left. If the bullet’s speed is so incredibly fast that the NEXT game cycle (frame) would place the bullet far to the right of the wall, it won’t matter if you defined isBullet or not. Its speed is so high, it doesn’t even recognize the wall.

“isBullet” basically increases the number of collision checks on a per-object basis. For example, it might “predict” multiple frame positions where the bullet MIGHT be in a single game cycle. But if the bullet is so fast as to supersede even that check, it will pass through some solid objects.

You can actually increase the physics sensitivity by adjusting the iterations. More iterations means more processor load, but if you can accept that, it should solve your current issue.

http://developer.anscamobile.com/reference/index/physicssetpositioniterations
http://developer.anscamobile.com/reference/index/physicssetvelocityiterations

Brent Sorrentino
Ignis Design [import]uid: 9747 topic_id: 26556 reply_id: 107739[/import]

Let me interject.

One simply does not solve this by upping the iterations. I’ve done EVERYTHING you can possibly think of to counter “tunneling” go read the box2d documentation, and search google “tunneling box2d” you will see this is an unsolvable issue.

Can you reduce it sure, but I would not advertise false hope. This isn’t a corona sdk thing it’s a box 2d thing. It has to do with rounding. In Cocos2d you can do “stepping” which makes the rounding more accurate. However think about this.

Dynamic vs static object = not a problem (usually, 99.99% of time)

Dynamic vs Dynamic = problems. WHY? Well, think about it. If rounding is happening on both objects and lets say they are a few pixels apart and are about to collide. One gets rounded and is a couple pixels to left, the other is to the right…oops they pass through each other and everyone is sad.

I’ve been working on this issue since June 2011, and it appears I must be the MOST hardcore advocate and been trying to help people out with this. It’s insane.

I have a lot of advice, even wrote my “MLMOCD” or multi layer multi object collision detection module. That reduces A LOT. It’s easy to do:

Create the bullet. Now create another object within the bullet and weld the 2 to each other

On the wall, create the wall and create another smaller wall.

Then you write a detection function of sorts that says when the inside object is within x and y from another object you apply a TEMPORARY damping to the object JUST before impact and then take it off. Performance will be hit though, so its a case by case basis.

I could go on and on and on, I have posts on here, all over the place about it. I have youtube videos, etc. isBullet helps, iterations help (hell, I’ve gone 1024 on velocity and position iterations, that barely helped. The things that seem to help most and are easiest is to slow things down.

PLay with the scale, use a scale of 6 or something and increase gravity to around 300 to 400 to get the same “feel” of scale 60 and 10 gravity…ok I’m done. I could rant on this all day long…

-Nick [import]uid: 61600 topic_id: 26556 reply_id: 107742[/import]