Small change to MultiBodyVehicle

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Small change to MultiBodyVehicle

Postby Nitrogenycs » Mon Jun 30, 2008 4:56 pm

Hello Julio,

would you consider adding this code to CustomMultiBodyVehicle:

In CustomMultiBodyVehicle.h file:

Code: Select all
   int AddSingleSuspensionTireFromBody (NewtonBody* tireBody, dFloat suspensionLength, dFloat springConst, dFloat springDamper);


In CustomMultiBodyVehicle.cpp file:
Code: Select all
int CustomMultiBodyVehicle::AddSingleSuspensionTireFromBody (NewtonBody* tireBody, dFloat suspensionLength, dFloat springConst, dFloat springDamper)
{
   float radius = 0;      // not used in CustomMultiBodyVehicleTire
   m_tires[m_tiresCount] = new CustomMultiBodyVehicleTire (GetBody0(), tireBody, suspensionLength, springConst, springDamper, radius);
   m_tiresCount ++;

   return m_tiresCount - 1;
}


In JointLibrary.h

Code: Select all
   JOINTLIBRARY_API int CustomMultiBodyVehicleAddTireFromBody (CustomJoint *car, NewtonBody* tireBody, dFloat suspensionLength, dFloat springConst, dFloat springDamper);


In JointLibrary.cpp
Code: Select all
int CustomMultiBodyVehicleAddTireFromBody (CustomJoint *car, NewtonBody* tireBody, dFloat suspensionLength, dFloat springConst, dFloat springDamper)
{
   return ((CustomMultiBodyVehicle*)car)->AddSingleSuspensionTireFromBody( tireBody, suspensionLength, springConst, springDamper);
}



I am creating the tire body myself during scene loading. So I can't use the CustomMultiBodyVehicle code as-is and have to compile my own version of JointLibrary. The proposed patch adds a second function to add your own body instead of letting the joint create one. I wasn't sure about the radius parameter, so I've just set to 0.

What do you think?

-Matthias
Nitrogenycs
 
Posts: 12
Joined: Fri Apr 07, 2006 4:45 am

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest