Advertisement

Mesh Binding

Started by November 03, 2006 03:30 AM
2 comments, last by BornToCode 18 years, 2 months ago
i've just started out developing games and would like to know how you would attach seprate meshes to each other. For example: I want to equip a sword to my character and have that sword coinside with that characters movements. ie: it must stay in the characters hand.
You'd bind the sword to the character, using a reference point on both objects. When updating animations, you'd move and rotate the sword so it's reference point stays locked at the reference point on the characters hand. That's the basic idea at least.

Implementing this depends on your design so far. You'd probably want to specify these points in the model files - Half-Life used an approach where such points where specified in a script file, and this data was then compiled into a model file together with the mesh and texture data. As for updating positions and rotations, that can be somewhat math intensive, so you'd better be familiar with those matrices. :) In fact, that's one of the reasons I went 2D for now - not too much math hassle, but games nonetheless. But that's another point entirely. :)
Create-ivity - a game development blog Mouseover for more information.
Advertisement
Oftentimes, the pivot of the mesh resides on a specific bone specified through a script/xml/binary file. For example, I made a bip01_r_weapon bone, and the mesh_sword's pivot is the same as it, and the mesh_sword is specified as a child of bip01_r_weapon, and when it is loaded, everything acts appropriately. That is how we are doing it for the game we're developing, and it works nicely.
-------------www.robg3d.com
What u want to do is get the matrix that represent the hand bones. Save it as a reference so whenever the mesh moves you will have access to the update matrix. Now what u want to do is take the matrix of the weapon and do a concatenation Like So.
Weapon=WeaponMatrix*HandBone;
Where WeaponMatrix represent the matrix of the weapon and the handbone is the reference of the hand bone.

This topic is closed to new replies.

Advertisement