Dropping a btBoxShape onto another btBoxShape, things get a little wacky. If I drop on the right side it works, but if I drop on the left side it goes through and then "explodes". Note the wheels (which are so far not connected to the body, also using btBoxShapes for now) seem to bounce through the sides of the wall.
http://vimeo.com/5754002
However, this only happens if the wall is offset from "origin". If I keep the wall centered over the origin, then both the left and right drops proceed as expected. Also, if dropping on the center of the wall, it always settles balanced on the top of the wall. The further the wall is from origin, the less margin there is from the center of the wall to get the "WTF" results. (In other words, if moved very slightly from the origin and dropped on the left side, the dropped object only indents the wall slightly and behaviors fairly normally.)
I have tried several different broadphases (btAxisSweep3, bt32BitAxisSweep3, btDbvtBroadphase), all produce qualitatively similar results. This is with the current SVN code.
Any ideas what I'm not doing right?
btBoxShape collision oddity (with video) [SOLVED]
-
- Posts: 96
- Joined: Mon Nov 03, 2008 9:57 pm
btBoxShape collision oddity (with video) [SOLVED]
Last edited by ejtttje on Fri Jul 31, 2009 3:54 pm, edited 1 time in total.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: btBoxShape collision oddity (with video)
Can you reproduce it by modifying one of the Bullet demos?
Thanks,
Erwin
Thanks,
Erwin
-
- Posts: 96
- Joined: Mon Nov 03, 2008 9:57 pm
Re: btBoxShape collision oddity (with video)
I have discovered my problem, but I'm not sure *why* it's a problem:
I was doing this:
dynamicsWorld->addRigidBody(body);
body->setWorldTransform(tr);
However, if I swap these:
body->setWorldTransform(tr);
dynamicsWorld->addRigidBody(body);
Then everything is happy. The order does not matter if the body has 0 mass (i.e. static collision body like the ground plane), but it does matter if I'm initializing a body with mass.
So my new question: why does "teleporting" an object break the collision detection (and/or dynamics response)? For initialization it's easy enough to just set the position first, but if I do want to teleport an object, say to reset a simulation without reconstructing the entire world, what's the right way to do that?
Thanks!
I was doing this:
dynamicsWorld->addRigidBody(body);
body->setWorldTransform(tr);
However, if I swap these:
body->setWorldTransform(tr);
dynamicsWorld->addRigidBody(body);
Then everything is happy. The order does not matter if the body has 0 mass (i.e. static collision body like the ground plane), but it does matter if I'm initializing a body with mass.
So my new question: why does "teleporting" an object break the collision detection (and/or dynamics response)? For initialization it's easy enough to just set the position first, but if I do want to teleport an object, say to reset a simulation without reconstructing the entire world, what's the right way to do that?
Thanks!
-
- Posts: 96
- Joined: Mon Nov 03, 2008 9:57 pm
Re: btBoxShape collision oddity (with video) [SOLVED]
For reference of those who come later, related threads:
http://www.bulletphysics.com/Bullet/php ... f=9&t=1150
http://www.bulletphysics.com/Bullet/php ... f=9&t=2428
http://www.bulletphysics.com/Bullet/php ... f=9&t=2513
semi-related:
http://www.bulletphysics.com/Bullet/php ... ?f=9&t=688
General short answer is it's best not to call setWorldTransform while the body is managed by the dynamics world... remove first and re-add afterward to keep everything in sync.
(probably should be noted in the doxygen documentation for setWorldTransform()...)
http://www.bulletphysics.com/Bullet/php ... f=9&t=1150
http://www.bulletphysics.com/Bullet/php ... f=9&t=2428
http://www.bulletphysics.com/Bullet/php ... f=9&t=2513
semi-related:
http://www.bulletphysics.com/Bullet/php ... ?f=9&t=688
General short answer is it's best not to call setWorldTransform while the body is managed by the dynamics world... remove first and re-add afterward to keep everything in sync.
(probably should be noted in the doxygen documentation for setWorldTransform()...)