Simple vehicile configuration

misterface

26-02-2006 13:42:42

me again ;)
experimenting with the simple vehicle example (demo5).
absolutely fantastic!

I did some modifications: int scale=10;

so the code becomes:


Ogre::Quaternion tireorient = Ogre::Quaternion(Ogre::Degree(0), Ogre::Vector3::UNIT_Y);
Ogre::Vector3 tirepos = scale * offset * Ogre::Vector3(x,0.5f,z);
Ogre::Vector3 pin(0,0,x);
Ogre::Real mass = 8; //30.0 standard
Ogre::Real width = 5;
Ogre::Real radius = scale*0.5;
Ogre::Real susShock = 200; //30.0 standard
Ogre::Real susSpring = 1000; //200.0 standard
Ogre::Real susLength = 2000; //1.2 standard


and

OgreNewt::Body* SimpleVehicle::makeSimpleBox( Ogre::Vector3& size, Ogre::Vector3& pos, Ogre::Quaternion& orient )
{
// base mass on the size of the object.

// (ZIE VANBOVEN!) standaard: Ogre::Real mass = size.x * size.y * size.z * 100.0;
Ogre::Real mass = 150


the problem is the folowing: when I drive the car, I easily flips, so I tried to make the car heavier, didn't solve it... made the wheels heavier, didn't sole it... but gave other problems: the car became unstable en began to jump.
what paramater(s) should I alter when I change the size of the car?

walaber

26-02-2006 18:48:11

the example car is thin, with a very high center-of-mass, so it will easily flip. probably the easiest way to fix that is to make the car proportionally wider...

misterface

27-02-2006 13:51:27

I'm trying to attach my cam to the vehicle.
making good progress :d

I made a method getDirectionCar():


Ogre::Vector3 SimpleVehicle::getPositieRolstoel(void)
{
return m_chassis->getOgreNode()->_getDerivedPosition();
}


and the cam I set with this:

msnCam->setOrientation(mCar->getDirectionCar());

when I drive the car the cam does everything I want!
but 1 problem I can't solve grmbl

the cam must be turned 90 degrees in the xy-plane (suppose z points to the sky)

so the code has to be something like:

msnCam->setOrientation(mCar->getDirectionCar()+90degreesxy);

the problem is xyz are related to the car and not the world....
Do I have to get the orientation of those xyz first and add 90,0,0 ...?
I guess there is a better way to solve this.

anyone? :)

misterface

28-02-2006 15:23:41

solved 8)