🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Rotate a joint by an angle

Started by
0 comments, last by David Marlowe 6 years, 3 months ago

I know this has probably been covered to death, but I'm having a hard time figuring out how I can do this. So I want to create some controllers for bones on my characters, which would allow the bones to rotate towards specific positions ingame, like for the head and eyes to look at something.  I'm having a tough time figuring out the math behind it. Keep in mind that my knowledge of matrix math isn't that good.

I'm trying to apply the transformations after the bone has been transformed to world space, but before it's children are also transformed. I also use 3x4 matrixes, and my coordinate system is right handed.

So here's what I was originally thinking of:

 - Set the controlled joint's real world angle in it's controller info structure, then I rotate this angle into the bone's local space, and store that in the model file.

 - When rendering, I transform the stored angle into the real-world angle by multiplying with the bone's rotation matrix after all other calculations have been done, and calculate the difference between this and the angle to the vector being pointed at.

 - I transform this back into the bone's local space, and create an angle matrix out of it, with which I multiply the bone's rotation matrix.

 

I was hoping it'd be this simple, but it's not working properly. I'm pretty sure I am messing something up, but I'm just not sure what. Can anyone please give some hints on this?

She plants her seed in my head, opium narcosis, hypnotic dread.

I feel her death growing in me, it's like a cancer yet I care the disease.

Lady death evolves from a flower, growing upon my tomb.

Into her ground I'm sinking lower. Skullflower.

This topic is closed to new replies.

Advertisement