Merge pull request #1622 from juhl/vehicle_axis

Fix to support different kind of wheel axis
This commit is contained in:
erwincoumans 2018-04-09 21:13:13 -07:00 committed by GitHub
commit 480cedf503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,11 +121,18 @@ void btRaycastVehicle::updateWheelTransform( int wheelIndex , bool interpolatedT
btQuaternion rotatingOrn(right,-wheel.m_rotation); btQuaternion rotatingOrn(right,-wheel.m_rotation);
btMatrix3x3 rotatingMat(rotatingOrn); btMatrix3x3 rotatingMat(rotatingOrn);
btMatrix3x3 basis2( btMatrix3x3 basis2;
right[0],fwd[0],up[0], basis2[0][m_indexRightAxis] = -right[0];
right[1],fwd[1],up[1], basis2[1][m_indexRightAxis] = -right[1];
right[2],fwd[2],up[2] basis2[2][m_indexRightAxis] = -right[2];
);
basis2[0][m_indexUpAxis] = up[0];
basis2[1][m_indexUpAxis] = up[1];
basis2[2][m_indexUpAxis] = up[2];
basis2[0][m_indexForwardAxis] = fwd[0];
basis2[1][m_indexForwardAxis] = fwd[1];
basis2[2][m_indexForwardAxis] = fwd[2];
wheel.m_worldTransform.setBasis(steeringMat * rotatingMat * basis2); wheel.m_worldTransform.setBasis(steeringMat * rotatingMat * basis2);
wheel.m_worldTransform.setOrigin( wheel.m_worldTransform.setOrigin(
@ -567,7 +574,7 @@ void btRaycastVehicle::updateFriction(btScalar timeStep)
const btTransform& wheelTrans = getWheelTransformWS( i ); const btTransform& wheelTrans = getWheelTransformWS( i );
btMatrix3x3 wheelBasis0 = wheelTrans.getBasis(); btMatrix3x3 wheelBasis0 = wheelTrans.getBasis();
m_axle[i] = btVector3( m_axle[i] = -btVector3(
wheelBasis0[0][m_indexRightAxis], wheelBasis0[0][m_indexRightAxis],
wheelBasis0[1][m_indexRightAxis], wheelBasis0[1][m_indexRightAxis],
wheelBasis0[2][m_indexRightAxis]); wheelBasis0[2][m_indexRightAxis]);