accessing the hierarchy of an imported mesh

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
raveneyes
Posts: 11
Joined: Wed Sep 03, 2008 5:49 am

accessing the hierarchy of an imported mesh

Post by raveneyes »

Hello all, I have a 3D Model of a vehicle in a .3DS format. The model has 5 parts: the chassis and 4 wheels.

So far I'm able to import the whole mesh and render it in my application, however I need to be able to create the different objects in my mesh serpartely or in other words, create a scenenode for each wheel and another scenenode for the chassis.

So Far I'm only able to import the whole mesh using these statements:
IAnimatedMesh* mesh = smgr->getMesh("mymodel.3ds");
IMeshSceneNode * node = smgr->addMeshSceneNode( mesh );

I'm new to irrlicht so plz bare with me :).

Your help is highly appreciated.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

The easiest way to do this is to just make each seperate part a seperate model. Then you can just load each in as a seperate node. To actually get out the required bits from an IMesh would be quite tricky i think, if not effectively impossible in most cases.

Plus that would only require 2 models; the chassis and one wheel. The wheel could be loaded once (instead of 4 times, so less memory) and then 4 scene nodes could be made from the same mesh.
Image Image Image
raveneyes
Posts: 11
Joined: Wed Sep 03, 2008 5:49 am

Post by raveneyes »

Thx for the reply JP, so as I understood correctly I need to create (in my case) 2 ".3DS" files with one housing the chassis and the other file housing one wheel and then import these in irrlicht and create the appropriate scene nodes.
But I'm little shocked about this. For example, let's say I modeled a character and I want to have access to his arm to rotate it or his head (Of course the arms, head and rest of the body will be created as seperate entities in the 3D modeler and exported in one file), it would be impossible unless i exported all the body parts in seperate files??.
I know its possible in other Game Engines, sorry if I misunderstood smthg along the way.

Like always, your help is highly appreciated.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Remember that Irrlicht isn't a game engine, it's a graphics engine ;)

You understood me correctly but i suppose there is another option, if you didn't use .3DS.

If you use a format that supports skeletal animation (.B3D, .X, MS3D) then you could put joints where the wheels are and rotate them in that manner (i imagine that's what you want to do). In that same way you could, with a character model, get the joints of an arm and manipulate it via code.
Image Image Image
raveneyes
Posts: 11
Joined: Wed Sep 03, 2008 5:49 am

Post by raveneyes »

ok, thx for clearing this out. I think I'll go for the .X format. Anyway, I was searching the forums for a code snippet on how to use the API to access the different joints but with no luck so far.
It would be helpfull if someone posted some pointers.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Why not look at the documentation instead of the forum? ;)
Image Image Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

APIs don't really get much simpler than u32 getJointCount() / getJointNode(u32 jointId).

getJointNode() returns an IBoneSceneNode *, which is derived from ISceneNode, and so has all of the ISceneNode methods. For your wheels, setRotation() is probably your first port of call.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
raveneyes
Posts: 11
Joined: Wed Sep 03, 2008 5:49 am

Post by raveneyes »

thx rogerborg, although your sarcastic remark was not needed.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Welcome to the filthy hippy meritocracy. Our customs may seem strange and harsh at first, but with time you too will join us.

Join ussssss.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
raveneyes
Posts: 11
Joined: Wed Sep 03, 2008 5:49 am

Post by raveneyes »

Well, what can i say other then Thx for the warm welcome :lol:
Post Reply