Hi Sanat,

I want to place a model of a truck over a 3D terrain that I created from DEMs 
and navigate the truck over the 3D terrain using my keyboard. However I am 
having trouble trying to think about what I need to do to get this done.

I can give you general pointers but to go into any detail you'll need to do some research on the web...

You need the following:

1. Your terrain model. You mention you want to create it from DEMs, you can use VirtualPlanetBuilder to do this.

2. Your truck model. You can use any of a range of modeling tools to create this, or download one from the web, or get someone to make it for you... If you want the wheels to turn you'll need to have them under transform nodes that you can control independently of the main model.

3. To place the truck and make it move on the terrain you can do it in a variety of ways, simple to complex and crude to accurate. It can go from simple raycasts at the wheels (which you can do with straight OSG code - look at osgUtil::IntersectionVisitor) to leveraging a physics and collision detection engine to get more realistic and smoother results (I won't suggest any but look at the end of my e-mail address for a hint ;-) ).

4. As for keyboard control, it depends on what you choose for 3, you can just control the truck directly with an OSG event handler (have a look at osgGA::GUIEventHandler) or at the other end of the spectrum you'd be able to give throttle settings that would drive the vehicle's gear box and give appropriate speed to the wheels (once again using the physics toolkit I won't name ;-) ).

I'm not here to advertise anything, just telling you you have a range of options and it depends on your needs and timeframe.

In any case, you can search the web or the OSG examples (in the sources if you've downloaded those) for some of the class names I've given above to get you started.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to