hi everyone,

i’m not able to solve my problem for 4 days now, i even get more confused

i’ll try to explain it as simple as i can, and i REALLY hope you can help me:

ok…

imagine a simple plane made of 4 points ( not really rectangular, but let’s say a table )

i have a toy car standing on this table.

i can drive around on it in any direction i like and to any point i like.

in code,i just have my plane on y == 0,and the car driving around, done by :

glPushMatrix();

glTranslatef(pos.x,0,pos.z);

glRotatef( (currDirection*180/PI), 0.0, 1.0, 0.0);

//draw the car…

glPopMatrix();

ok,very nice so far…

now, if someone would lift the table on any edge or just on one edge-point(would make not much difference i think), the car would fall off the table ( ok,this is not my problem,thats just a matter of gravity…).

assuming that there’s no gravity , the car would just stand on the table like before on the flat table, and it could drive around just like before.

And exactly this is my problem…

in my code, the “table” is tipped at start,just by taking 2 points and lift them to y == 5 for example, (BTW i cant tip just the car WITH the plane,the whole world is made of many different planes and the car should know how to stand on the planes itself,and the car can drive from table to table,and all of them are tipped different,…).

so what i tried to do:

1.for each table,i define a normal to it(cant figure that out exactly, too…dotproduct,crossproduct?) )

2.look on which table the car is at the moment( could i make this by calcualting the distance from the car to the very next normal,and then say, “aha…normal nr.xxx is next to me,so it’s got to be table nr.xxx” ??)

3.translate and rotate the car this way,that it’s really standing orthogonal to the plane,regardless on which point of the plane?

as i played around with the code,i think i somehow got the car-rotations right,but there was the problem that the car just moved “through” the plane, standing beneath it, instead of driving the plane up or down,coz the height-level of the car never changed… so maybe i have to translate the car to another height too (or will the rotation do that for me??).

for me this is an advanced problem(when i think of some 1stperson shooters,you just need to change the height-level of the player and thats it)

i’m really frustrated right now, my head is full of vectors

hope you can help me soon, coz the whole game will be frozen and i cant go on with it