# Get Car Rotation on Terrain ?!

hi, i have got an terrain and want to get a car driving on it. I have calculated 4 Points which represents the 4 wheels in x,z coordinate. The y-value is the height of the terrain in the point(x,z).

so now i have got:

frontleft x,y,z
frontright x,y,z
backleft x,y,z
backright x,y,z

now i need the rotation axis of car, represents by the heightvalues of my 4 points. But how can i get my x and z rotation? (the y-rotation is the direction angle of the car)

could somebody write down the maths i need for that?

ah, if you something dont understand take a look on my newest Terrain and Console Demo @
/general site/ www.mofux.de.vu www.spicken.de/mofux

[This message has been edited by MofuX (edited 12-20-2001).]

I too am looking for realistic automotive physics. By realistic I mean taking in account hp, torque, gear ratios, suspension and what not. YES I know this is NOT on topic but I didn’t start the thread. Just a link would be nice. Thanks a lot.

torcs.sourceforge.net a good good start.

and also give a look on gamasutra and gamedev.net for some interesting articles on drivign game physics.

hope this helps…

Decide which 3 of the four wheels are on the ground, then compute the normal to the plane formed by these three points.

Check this out:
http://members.home.net/rck/phor/

-Lev

yes mates, i’ve got it… who is interested:

first calculate the high of your 4 wheels!

across=((frontrighth-frontlefth)+(backrighth-backlefth))/2.0f;

length=((backlefth-frontlefth)+(backrighth-frontrighth))/2.0f;

so you get the x and z rotation… thats all