Is this a bug, or expected behaviour, or am I doing something wrong.
If the movement between the From and To is 0.04 units or smaller, it seems to never return a collision.
Is that correct? Should I be elongating the distance for the check?
I basically have a bunch of cubes forming a floor, then am calling convexSweepTest on an object (tried a sphere and a box), with downwards - which doesn't add the movement to its position if it detects a hit from convexSwepTest..
It works fine if travelling 0.1 units, but passes through at 0.04 or below.
convexSweepTest never hits when tracing very small distances
-
- Posts: 10
- Joined: Mon Nov 17, 2008 10:40 pm
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: convexSweepTest never hits when tracing very small distances
If the distance is below a given threshold, the CCD will not return a hit. The default threshold value is 0.04.
You can disable this threshold by setting this threshold to zero, using
To avoid confusion, things are different in latest trunk. The allowedCcdPenetration is now passed in as optional argument to the btCollisionWorld::convexSweepTest, with default value 0 (and not 0.04).
For better performance on short swept queries, it might be better to insert a btGhostObject in the world, and leave it in the world as long as you need to perform short queries in a certain area. A btGhostObject incrementally gathers overlapping objects.
Then perform the btGhostObject::convexSweepTest, just like the btCollisionWorld::convexSweepTest. This will only test the ghost overlapping objects (instead of traversing world/broadphase acceleration structures).
So please upgrade to latest trunk or Bullet 2.73 RC5/final.
Hope this helps, and thanks for the feedback,
Erwin
You can disable this threshold by setting this threshold to zero, using
Code: Select all
collisionWorld->getDispatchInfo().m_allowedCcdPenetration = 0;
For better performance on short swept queries, it might be better to insert a btGhostObject in the world, and leave it in the world as long as you need to perform short queries in a certain area. A btGhostObject incrementally gathers overlapping objects.
Then perform the btGhostObject::convexSweepTest, just like the btCollisionWorld::convexSweepTest. This will only test the ghost overlapping objects (instead of traversing world/broadphase acceleration structures).
So please upgrade to latest trunk or Bullet 2.73 RC5/final.
Hope this helps, and thanks for the feedback,
Erwin
-
- Posts: 10
- Joined: Mon Nov 17, 2008 10:40 pm
Re: convexSweepTest never hits when tracing very small distances
Awesome, just updated - it now works exactly as I'd have expected - thanks!
btGhostObject sounds really useful. Would it be wise to surround all moving entities in a btGhostObject, which extends to their maximum velocity - or would all usefulness be eradicated by that?
btGhostObject sounds really useful. Would it be wise to surround all moving entities in a btGhostObject, which extends to their maximum velocity - or would all usefulness be eradicated by that?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: convexSweepTest never hits when tracing very small distances
It depends, a ghost object has some memory/performance overhead. Typical use case for btGhostObject is a character controller or small local collision triggers for AI. The btKinematicCharacterController peforms several convexSweepTests to slide along walls and peform stair climbing.angrybaker wrote: btGhostObject sounds really useful. Would it be wise to surround all moving entities in a btGhostObject, which extends to their maximum velocity - or would all usefulness be eradicated by that?
- If the velocity/swept query is very large, the benefit of a ghost object is reduced, and using the btCollisionWorld::convexSweepTest is likely better
- If you plan to perform several short convex sweep tests for each entity, every frame, you can consider creating btGhostObjects.
- If you only use a convexSweepTest once in a while, for only a few entities, using the btCollisionWorld::convexSweepTest could be better.
Thanks,
Erwin