Raycast misses body after position is changed
-
- Posts: 37
- Joined: Wed Jul 27, 2011 12:01 am
Raycast misses body after position is changed
I have a frozen scene with a bunch of objects. I ray cast to get the nearest one, and that works. Now after I manipulate its position using rigid_body->getWorldTransform().setOrigin(Vector); future ray-casts miss it completely. The visualized ray goes right through it but no points are generated. If I step the world once this problem is fixed. Am I doing something wrong there?
-
- Posts: 37
- Joined: Wed Jul 27, 2011 12:01 am
Re: Raycast misses body after position is changed
Here's a video showing that bug in action - am I abusing the API or did I come across a bug in Bullet?
http://www.youtube.com/watch?v=g_jDwJz3Bes
http://www.youtube.com/watch?v=g_jDwJz3Bes
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Raycast misses body after position is changed
You need to make sure the broadphase acceleration structures are up-to-date.
If you are not calling 'stepSimulation' or performDiscreteCollisionDetection, you might want to try this:
Thanks,
Erwin
If you are not calling 'stepSimulation' or performDiscreteCollisionDetection, you might want to try this:
Code: Select all
world->updateAabbs();
broadphasePairCache->calculateOverlappingPairs(dispatcher);
Erwin
-
- Posts: 37
- Joined: Wed Jul 27, 2011 12:01 am
Re: Raycast misses body after position is changed
That fixed it - thanks a lot.