How to find a Vehicle orientation over a 3D terrain?

Started by
11 comments, last by ogracian 22 years, 6 months ago
Hello

FreakChild: about the normal interpolation method, could you be a little more specific about it, maybe some code would be a plus,
because I am doing LERP beetween my current normal and my desired plane normal, but it dose not work, so I really appreciate so much any help.

Ex:
a = MatrixGetUp(car_matrix);
b = collision_PlaneNormal;
p = lerp(a, b, DeltaTime);

//
// computes vehicle new orientation
// based in p (the interpolated normal)
up = &p
CrossProduct(right, up, at);
Normalize(right, right);
CrossProduct(at, right, up);
Normalize(at, at);
MatrixUpdate(car_matrix);

Thanks!
Oscar


Advertisement
I can''t really see anything wrong with that. Without the lerp I guess your code more or less puts ''b'' as the up vector. b is the average of the normals taken from your wheels.

In the new function, it''s the desired orientation and you simply interpolate to the desired each frame. You''ve probably got the idea of that already, but no harm in being sure about it.

With the pseudo code you presented being okay, I suspect the problem is deeper. As the psuedo code is just your old code, which flicked between orientations and it worked, you might want to check that lerp function and be sure it''s working.

You mention what you''ve done so far with the lerp doesn''t work...what are the actual results though?
hello

I found the my error, it was in the lerp funtion, I got it working now, thank you all for your help!!

Best Regards!
Oscar

This topic is closed to new replies.

Advertisement