- Home /
Move a bone without rotating it
Hi,
Sorry, Im new to Unity and my english is not good enough to explain what my problem is, but I will try (check the attached picture too).
The problem is, as far as I understand, in Unity bones are just nested transforms, and probably my maths aren't very good either.
So imagine the mesh in the picture is a finger with one single bone: when pointing in different locations I would like to move the ending point of the bone, without rotating it. Why without rotating it? Since if the bone is rotated, the whole mesh is rotated, and obviously a finger shouldn't rotate around its longitudinal edge, just move its end edge to another position.
Yesterday I asked if there is some way to move a bone using bone.start = new Vector3(x1,y1,z1); bone.end= new Vector3(x1,y1,z1); and I found that it is not possible, since movements are defined in forward kinematics, that is rotation and translation, because bones are transforms.
So I have been trying and found that if I apply forward kinematics trying to reach the target end position, performing rotations, the whole mesh is rotated since the bone is rotated. I would like to reach a point (move a bone) without rotating it, since the "flesh" around it should remain in the same position (top in top, left in left, etc.. ), I just want to move the position of my mesh without rotating it. What I'm doing bad? Is there any way to move the end point of the bone without using rotations?
hummm... I think that the problem is that I don't want rotations in the longitudinal axe. Definitely my maths are very weak, can someone point me how to understand this 3D maths problem? Detect wich transforms should be applied to a vector to become another one without rotations in one axe? Is there any 3D maths for beginers online resource or something like that, that would help me to perform inverse kinematics for a simple vector? (it is not even a chain of transforms as usual inverse kinematics)
Thank you!
You certainly win, very easily, the award "$$anonymous$$ost Interesting Questions Ever Asked By A New User"
You also easily take the "$$anonymous$$ost stylish and casually competent diagrams and drawings" palme d'or for 2012! :)
Just FTR, when you say "apply forward kinematics..." in P6/S1, what do you mean? ie, you are using a package, or mecanim or something, or what? Cheers
hahaha, thank you Fattie :D I'm not used to ter$$anonymous$$ology yet, with "forward kinematics" I mean normal animations (the opposite of inverse kinematics): using translations and rotations / keyframed animations. There is a lot to learn! Unity is quite big and $$anonymous$$aths are scary like a huge monster haha.
Answer by Fattie · Dec 27, 2012 at 09:17 AM
hysp , I believe the very simple answer to what you need is:
What you're basically saying is, after the move, you want the rotation, to be, in some certain rotation. (Indeed, "sort of like a natural finger.")
{Note that, IMO, there is no real natural meaning to "not rotate" when you twist/change something like a bone concept - it's like, whoever made the software in question left the bone rotation in some position that seems, to him or her, the "natural" outcome rotation wise of that bend - perhaps you see what I mean. Anyway, even if you don't see what I mean - it's irrelevant! :) }
Anyway in short, all you do is force the rotation to be what you prefer, after the other operation! That's it. So, in assembler:
finger .. change per your IK pack, or whatever
finger .. set the rotation "neutrally" as you want it
It is extremely common to have to do that sort of thing. A good example is very often you have a whole lot of code, and then, "no matter what" you end with a quick "LookAt" to keep everything oriented correctly. Hope this helps in some way.
Thank you! LookAt will do :-) Seems that you are always around to help people :-) It feels great to have a place like this where you can ask about difficulties while coding, see you arround Fattie!
Funnily enough yes ... you can actually use "LookAt" specifically, in this situation.
I merely mentioned that as an example of something where you very often have to do it "each time through, at the end of doing some process"
Funny one! Really glad it helps all around, cheers.