Vehicle driving over terrain

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Valaris
Posts: 8
Joined: Wed Sep 23, 2009 4:25 am

Vehicle driving over terrain

Post by Valaris »

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?
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

This is something that Irrlicht does not support, as it's more than graphics. For this you should use a physics API like ODE, Bullet or PhysX. Search for these here in the forum and you'll find some wrappers that bring together Irrlicht and the physics engines.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Bear_130278
Posts: 237
Joined: Mon Jan 16, 2006 1:18 pm
Location: Odessa,Russian Federation

Post by Bear_130278 »

For this you should use a physics API like ODE, Bullet or PhysX
Cmon man.... you have Frightened him with this...
What he wants is a pretty simple math...
1.Get the normal of the point you are on
2.Calc the angle between this normal and vertical
3.Rotate the model on this angle.
Do you like VODKA???
Image
Image
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

I think if he wants (as he wrote) some sort of realism it would be best to use a physics API instead of writing a new one ;). It is not that difficult to get that done with all the physics wrappers floating around the forum.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

you have a function called getHorizontal angle ;)
Image
Image
Eigen
Competition winner
Posts: 375
Joined: Fri Jan 27, 2006 2:01 pm
Location: Estonia
Contact:

Post by Eigen »

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.

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
...
I hope it gives you an general idea.
Post Reply