btRaycastVehicle - movement direction and wheels rotation
Posted: Fri Jun 16, 2017 5:08 pm
I'm trying to use btRaycastVehicle in my opengl engine. Bullet world space coordinate system is the same as opengl world space coordinate system, i.e. -z axis goes forward (right handed). btTransform places rigid bodies as I expect.
When I add the engine force:the vehicle moves in +z direction but wheels don't rotate.
A third parameter of addWheel function(wheelAxleCS) is defined as [-1, 0, 0]. I have noticed that by default a vehicle forward vector (vehicle->getForwardVector()) is defined as [0, 1, 0], so how it is possible that the car moves in +z direction at all?
How to achieve a movement in -z direction and wheels rotation?
I get transformations this way:
When I add the engine force:
Code: Select all
physicsEngine.getVehicle()->applyEngineForce(500, 2);
physicsEngine.getVehicle()->applyEngineForce(500, 3);
A third parameter of addWheel function(wheelAxleCS) is defined as [-1, 0, 0]. I have noticed that by default a vehicle forward vector (vehicle->getForwardVector()) is defined as [0, 1, 0], so how it is possible that the car moves in +z direction at all?
How to achieve a movement in -z direction and wheels rotation?
I get transformations this way:
Code: Select all
//vehicle body
vehicle->getRigidBody()->getMotionState()->getWorldTransform(transform);
transform.getOpenGLMatrix(mat);
//for each wheel
vehicle->updateWheelTransform(index, true);
transform = vehicle->getWheelInfo(index).m_worldTransform;
transform.getOpenGLMatrix(mat);