Hi,
Perhaps this has been answered before, but I'm not even sure what the name of the technique for this is called.
Basically I am able to load up my terrain, as well as my vehicle, but I am unsure how to "drive" that vehicle over terrain. IE have it react realistically to the uneveness of say a hill (IE: rotate upwards).
Is this a fairly advanced technique, or something that irrlicht can easily perfofrm?
Vehicle driving over terrain
-
- Posts: 237
- Joined: Mon Jan 16, 2006 1:18 pm
- Location: Odessa,Russian Federation
I trace 4 lines from each wheel and then use the result (4 ground positions) to construct 2 triangles, so it forms a quad beneath the vehicle. Then I take the average normal of the two triangles and use the normal to rotate my vehicle.
I hope it gives you an general idea.
Code: Select all
// RRCollision - Rear-right wheel collision point
// FLCollision - Front-left
// ...
Triangle1 = triangle3df(RRCollision.point, FRCollision.point, FLCollision.point);
Triangle2 = triangle3df(FLCollision.point, RLCollision.point, BRCollision.point);
vector3df AvgNormal = (Triangle1.getNormal() + Triangle2.getNormal()) / 2;
// Rotate node based on the normal
...