attaching meshes
attaching meshes
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
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
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...
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...
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.
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