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
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
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
-
- Posts: 237
- Joined: Mon Jan 16, 2006 1:18 pm
- Location: Odessa,Russian Federation
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
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
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
...