attaching meshes

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
rogerdv
Posts: 93
Joined: Wed Aug 27, 2003 4:20 pm

attaching meshes

Post by rogerdv »

I was curious about this since along time ago. What is the way to attach one mesh to another, like a weapon to a character's hand? I think md2 format allow to do this, but what is the solution for other formats?
ru guo ni yao ai, ni jiang bu hui shi qu
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

md2? I don't know any easy way to do it with .md2. If you know a way, I'm curious. For .x or .ms3d one can get a transformation matrix of a joint, and use that. (or if you use the .md3 loader someone made you can use tags). X and ms3d are skelton based, making things like that fairly easy, while .md2 is totally vertex based
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

use your player model as parent node to create weapon node
rogerdv
Posts: 93
Joined: Wed Aug 27, 2003 4:20 pm

Post by rogerdv »

arras wrote:use your player model as parent node to create weapon node
and the correct coordinates and animations?
ru guo ni yao ai, ni jiang bu hui shi qu
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

with coordinates it should work simple, you can give offset to second node since it places itself relative to parent position.

With animation ...well thats harder, since there are no functions for limb control and you cant get position of individual limbs.
You can just play individual animations of both nodes, but that is not going to solve your poblem as I understant it.

You can try to build your character from several nodes -one node for each limb like arms, torzo, head etc...
rogerdv
Posts: 93
Joined: Wed Aug 27, 2003 4:20 pm

Post by rogerdv »

I got this answer in Gameprogrammer list:

One way is to use dummy objects in the main mesh, say the player (If yourusing max they are called dummy, I think lightwave calls them null objects)Basically they are objects that have position / rotation information but noactual mesh data. Attach the dummy object to the hierarchy of the model, soit moves with the arm etc, and another to the relevant point on the othermesh, say the gun. Now when you want to attach them, you can either connectthe two dummy objects in your own engine hierarchy or just set the gunposition/rotation based on the information in the main player dummy object.Some meshes ive worked with will have several of these dummy objects (youcan name them all so you can find them etc - depending on how you use theinformation in your code), like hand point for attaching weapons, firepoints, where bullets come from when you fire etc.
ru guo ni yao ai, ni jiang bu hui shi qu
Post Reply