Attaching object to a bone in a skeleton... A BIG HEADACHE
Ok I am attempting to attach a gun to a bone in a skeleton.
The axes that I am using are as follows:
http://www.flickr.com/photos/63376021@N00/323279164/
So the main model is looking down the +Z axis. Also the gun I wish to attach is also looking down the +Z axis..
Now here are the axes for the bone I wish to attach the gun to:
http://www.flickr.com/photos/63376021@N00/323279166/
I am sure you can already see the problem. When I attach to the bone, the gun follows this bone's orientation. So while the main body is facing forward the gun is facing sideways with respect to the body, since it is tracking the orientation of the bone.
My problem is how do I make the gun face in the direction of the body but still track the bone it is attached to? It seems like these are conflicting requirements. I've bashed my head over this and can't seem to come up with a valid solution.
I can't just modify the bone to get the proper orientation as it will throw the skinning out of wack.
I'd greatly appreciate any help anyone can give me...
THanks in advance
You can either re-orient the gun model in modeling software to align with your character, or your'll need a transformation matrix between the bone and the gun.
So, drawing the gun like this
ModelMatrix = BoneX
DrawGun
You'd do
ModelMatrix = Re-orientMatrix * BoneX
DrawGun
You should just model everything the same coordinate system so that everything aligns the same in your game.
So, drawing the gun like this
ModelMatrix = BoneX
DrawGun
You'd do
ModelMatrix = Re-orientMatrix * BoneX
DrawGun
You should just model everything the same coordinate system so that everything aligns the same in your game.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement