Bullet world space coordinate system is the same as opengl world coordinate system (-z = forward). I have noticed that raycast vehicle has the following function:
virtual void btRaycastVehicle::setCoordinateSystem(int rightIndex, int upIndex, int forwardIndex)
How does that function work ?
By default raycast vehicle has the following parameters:
- forward vector: [0, 1, 0]
- forward axis: 1
- right axis: 0
- up axis: 2
1. Does it mean that y axis is swapped with z axis ?
2. Why a default raycast vehicle coordinate system differs from bullet world space coordinate system ?
I have to set coordinate system this way to get my vehicle move correctly (including wheels rotation):
raycastVehicle.setCoordinateSystem(0,1,2);
Then I get the following parameters:
- forward vector: [0, 0, 1]
- forward axis: 2
- right axis: 0
- up axis: 1
To move a vehicle forward I have to set a negative force:
applyEngineForce(-2000, 2);
applyEngineForce(-2000, 3);
I'm a little bit confused: I would expect that a forward vector returned by raycast vehicle will be defined this way: [0,0,-1] when a negative engine force moves a vehicle forward.
3. Could you explain it ?