3d Car with Selectable Items

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
suresh4irrlicht
Posts: 3
Joined: Mon Feb 06, 2012 7:12 am

3d Car with Selectable Items

Post by suresh4irrlicht »

Hi,
I am very new to 3d space and Irrlicht engine.
I have a car image which is in 3ds format and can able to load through Irrlicht engine.
My main task is to select different items of car like doors, tyres, lights etc using mouse. I have implemented EventReceiver also but unable to select any item of the car.
Please guide me how i can select items from 3ds image using Irrlicht engine.

Thx
Babu
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: 3d Car with Selectable Items

Post by hybrid »

In general you simply can't do this. The 3ds loader will usually re-group vertices based on material definitions, and hence you can easily lose all the previously defined structures. But even if you keep those groups (e.g. by defining different materials for each one) you don't have an easy access to them. The loader is allowed to re-arrange mesh buffers, which makes it hard for proper selection, at least if you want to assign those groups some externally saved properties. What you can do in this case is just to move around those groups, and assign different material properties. You simply access the mesh buffers of the mesh.
A better way would be to use a simple skeleton (with .b3d or .x format for example) and access the named bones to select the groups. These are always kept during loading, and due to the naming you can even save external properties. Maybe describe a littel more the setting in which you are working with those groups so we can help better.
pera
Posts: 460
Joined: Wed May 14, 2008 1:05 pm
Location: Novi Sad, Serbia
Contact:

Re: 3d Car with Selectable Items

Post by pera »

Maybe you want separate model for each item. Doors, tires, shell, lights, everything is separate 3ds file. Then its easy for selection (just see picking tutorial).
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: 3d Car with Selectable Items

Post by smso »

As a first step load the 3ds model in irrlicht and turn on some debug data:

Code: Select all

model->setDebugDataVisible(scene::EDS_BBOX_ALL);
What you would see is a number of boxes corresponding to different parts of the model or, in terms of irrlicht, different mesh buffers making up the overall model mesh.

The overall steps are as follows:
1. find collision triangle using scene::ISceneCollisionManager
2. transform the 3 vertices (which are in world) of the triangle into local space of the model
3. search the vertices through different mesh buffers
4. if step 3. is ok, highlight the bounding box of the found mesh buffer by e.g. drawing 3d lines

Caution: you will have a long journey to the goal!

Regards
smso
suresh4irrlicht
Posts: 3
Joined: Mon Feb 06, 2012 7:12 am

Re: 3d Car with Selectable Items

Post by suresh4irrlicht »

Thank you guys for replying.
Still i am not clear how to go with my requirement. Let me explore more and can post exact requirement.

Thx
Suresh
Post Reply