The first is on lines 197/198 is btRaycastVehicle.cpp in 2.76
Code: Select all
btScalar minSuspensionLength = wheel.getSuspensionRestLength() - wheel.m_maxSuspensionTravelCm*btScalar(0.01);
btScalar maxSuspensionLength = wheel.getSuspensionRestLength()+ wheel.m_maxSuspensionTravelCm*btScalar(0.01);
Code: Select all
wheel.m_worldTransform.setBasis(steeringMat * rotatingMat * basis2);
wheel.m_worldTransform.setOrigin(
wheel.m_raycastInfo.m_hardPointWS + wheel.m_raycastInfo.m_wheelDirectionWS * wheel.m_raycastInfo.m_suspensionLength
as long as maxSuspensionLength is capping it to be. The suspension, according to the raycast, can only go from 0 (the hard stop point) to rest length. That raycast should actually go from the hard stop to the max travel meaning that the two code snippets above should look like:
Code: Select all
btScalar minSuspensionLength = 0
btScalar maxSuspensionLength = wheel.m_maxSuspensionTravelCm*btScalar(0.01);
Code: Select all
wheel.m_worldTransform.setBasis(steeringMat * rotatingMat * basis2);
wheel.m_worldTransform.setOrigin(
wheel.m_raycastInfo.m_hardPointWS + wheel.m_raycastInfo.m_wheelDirectionWS * wheel.m_maxSuspensionTravelCm*btScalar(0.01);
Now for second issue...
on like 444 of btRaycastVehicle.cpp
Code: Select all
wheel_info.m_wheelsSuspensionForce = force * chassisMass;
For the spring constant, it would be in Newtons/Meter/Kg and the damper would be in Newtons/(Meter/second)/Kg.
It's conceptually similar to setting the spring using the frequency and damper based on the fraction of critical damping, but you need to know things like the number of wheels, the position of the center of mass, etc to calculate it that way.
I really think that line should just look like:
Code: Select all
wheel_info.m_wheelsSuspensionForce = force;