Reputation: 2754
I'm trying to make a simple raycast vehicle in bullet. It is supposed to be a box on sour wheels.
I'm now stuck with the calls to btRayvastVehicle::addWheel
, because I don't understand what exactly they mean, as they're not well documented in the API documentation and as a non-native English speaker, I'm having a hard time, to infer what they are based on their names.
What particularly puzzles me, is how exactly the three first parameters define the position and orientation of the wheel.
So what exactly do the parameters of btRaycastVehicle::addWheel
do?
Upvotes: 1
Views: 815
Reputation: 117856
From the documentation the method btRayvastVehicle::addWheel
has the signature
btWheelInfo & btRaycastVehicle::addWheel( const btVector3& connectionPointCS0,
const btVector3& wheelDirectionCS0,
const btVector3& wheelAxleCS,
btScalar suspensionRestLength,
btScalar wheelRadius,
const btVehicleTuning& tuning,
bool isFrontWheel
)
From the method definition you can click on each of the member variables to go to the header (which is also very vaguely documented unfortunately).
//
// basically most of the code is general for 2 or 4 wheel vehicles, but some of it needs to be reviewed
//
btWheelInfo& btRaycastVehicle::addWheel( const btVector3& connectionPointCS, const btVector3& wheelDirectionCS0,const btVector3& wheelAxleCS, btScalar suspensionRestLength, btScalar wheelRadius,const btVehicleTuning& tuning, bool isFrontWheel)
{
btWheelInfoConstructionInfo ci;
ci.m_chassisConnectionCS = connectionPointCS;
ci.m_wheelDirectionCS = wheelDirectionCS0;
ci.m_wheelAxleCS = wheelAxleCS;
ci.m_suspensionRestLength = suspensionRestLength;
ci.m_wheelRadius = wheelRadius;
ci.m_suspensionStiffness = tuning.m_suspensionStiffness;
ci.m_wheelsDampingCompression = tuning.m_suspensionCompression;
ci.m_wheelsDampingRelaxation = tuning.m_suspensionDamping;
ci.m_frictionSlip = tuning.m_frictionSlip;
ci.m_bIsFrontWheel = isFrontWheel;
ci.m_maxSuspensionTravelCm = tuning.m_maxSuspensionTravelCm;
ci.m_maxSuspensionForce = tuning.m_maxSuspensionForce;
m_wheelInfo.push_back( btWheelInfo(ci));
btWheelInfo& wheel = m_wheelInfo[getNumWheels()-1];
updateWheelTransformsWS( wheel , false );
updateWheelTransform(getNumWheels()-1,false);
return wheel;
}
So it looks like the first 5 arguments essentially describe the position and orientation of each of the wheels. The 6th argument (tuning
) seems to describe mechanical properties of the tire such as friction, damping, etc. The last parameter seems self-explanatory.
Upvotes: 1