c++bulletphysics

btRaycastVehicle's btWheelInfo rotation is incorrect


I use C++ Bullet Physics. I spawn btRaycastVehicle on the btTriangleMesh. I update the wheel model by using vehicle->getWheelTransformWS(i).getOpenGLMatrix(mat); matrix. As you can see in the clip below wheels steering turns OK, their positions in World Space are correct but rotations are completely off. btWheelInfo's m_rotation or m_deltaRotation also give me wrong results for example after complete stop there is still some m_rotation. Also vehicle->getCurrentSpeedKmHour() behaves wrong for me. When I accelerate it gives me negative number but when the throttle is released speed is again positive number. Where should I seek problem? Should I set some parameters for ground ?

Video with problem: https://www.youtube.com/watch?v=QHt8TFLrrik


Solution

  • I found an issue and now it works, take a look here: https://youtu.be/s4ElFeGeAfM The problem was that I was not setting vehicle coordinate system. Now when I do with vehicle->setCoordinateSystem(0,1,2); it works perfectly.