behdad / box2d

Automatically exported from code.google.com/p/box2d
2 stars 12 forks source link

Sensors skipped in TOI solving #86

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In b2World.cpp, around line 570, when solving TOI all pairs where at least one 
of the fixtures is a 
sensor are ignored.

I use a static sensor box to delimit world boundaries and delete dynamic 
bullets when they intersect 
the sensor. With the above code, some bullets quits the box. If I comment the 
code in b2World.cpp, 
no bullets are lost. The same solution is achieved changing the box to a simple 
static, non-sensor 
box. But world boundaries should be really a sensor.

Is it a bug? Otherwise, why skipping sensors? Can't they be part of normal TOI 
solving?

Original issue reported on code.google.com by daniele.benegiamo@gmail.com on 15 Feb 2010 at 12:50

GoogleCodeExporter commented 9 years ago
For sensors there is no time of impact because there is never any impact. 
Sensors allow 
shapes to pass through each other.

Instead you should use ray casts to detect when fast moving objects cross 
boundaries. 
In the case of a world box, you could just check the body's coordinate.

Original comment by erinca...@gmail.com on 28 Feb 2010 at 7:27

GoogleCodeExporter commented 9 years ago
I understand that sensors have no impact, but as it could be easily computed why
don't use it to resolve tunneling? (of course skipping the processing of the 
"impact").

While "world box" problem is easy to solve, the general case is not. You 
suggest to
use ray casts to detect if a fast moving object cross a (moving) sensor, but 
doing so
means that I must manually inspect all N*M cases (N moving objects, M sensors),
manually resolving the tunneling, and thus skipping at all Box2D 
(callback/filtering
systems, islands, and so on). Is not better to make TOI resolve tunneling also 
for
sensors (as it could just do it)? Or maybe I don't have understood your reply.

Original comment by daniele.benegiamo@gmail.com on 1 Mar 2010 at 10:42