I am trying to make my characters arms point at the cursor(like holding guns and shooting at the cursor). btw my game is using chaseCamera so it’s a 3rd person game.
Now what I have tried is that, when I made my character in blender, I added constraints to the hand bones so they were tracking a third bone floating infront of the character. The Inverse kinematics did all the work moving other bones in the hands, so it would look realistic. The thing is it all works fine in blender, but as I came to a conclusion that the ogreXML exporter doesn’t export the constraints info with the bones.
I tried changing the position of the tracker bone in JME: the bone moves but the hands won’t track it. I don’t know if it is because the hands are locked because of the idle animation or the tracking constraint is just not there.
Any ideas how it is done in other games, or what would be the best way to approach this problem.?
Here are two pictures, one in blender and one in JME:
You’ll have to do inverse kinematics yourself…
Edit: Though I suggest going with normal aiming animations and a simple moving of the whole upper body like most games do it, maybe even make the up/down aiming one full animation that you play partially.
So just to make sure I understood correctly:
I would make a weapon holding animation for the hands moving from down to up and the in JME set userControl = true for the spine bone and then rotate the spine and set the animation a fixed keyframe?
somehow like that yeah, you need setUserControl only for actually moving the bones though, not for playing animation. you can set the speed to 0 for that.
Okay. I got this far, that I have two vectors, one is the point where the cursor is relative to the character and the second is the character view direction. Bot vectors are normalized and I want to get the angle between them. I use angleBetween, but the problem is that it will give me the angle until PI, both ways, not until 2PI. I need that angle to rotate the spine bone, but since it goes up to only PI then to one side the character body turns correctly, but to the other it’s mirrored.
I don’t think you should mess with angles and rotations, use direction vectors, much more consistent and easy to grok.