Raycast vehicle chassis position bug

ragerma
Posts: 2
Joined: Wed Oct 10, 2007 11:20 pm

Raycast vehicle chassis position bug

Post by ragerma »

I encountered a problem that when getting the position of the chassis, it always seems lag behind the wheels especially when the vehicle moves fast. I fixed this problem by getting the position through the motionState object.

m_vehicle->getChassisWorldTransform().getOpenGLMatrix(&m); //this gives the wrong position of the chassis. :(
m_carChassis->getWorldTransform().getOpenGLMatrix(&m);//this also gives the wrong position of the chassis. :(

btTransform tr;
m_carChassis->getMotionState()->getWorldTransform(tr);//this gives the right position. :D
tr.getOpenGLMatrix(&m);
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Raycast vehicle chassis position bug

Post by Erwin Coumans »

Actually this is not a bug, but it should be better documented indeed.

Users should use the motion state for properly interpolated transforms. This becomes more apparent for high speed objects with interpolation. There is some mention about this in the Bullet manual, but obviously not enough.

Thanks,
Erwin