Bones and LookAt Rotations Help Needed


Okay so the half this week I’ve been playing around with bones and their rotations. I had a concept of making a very, very simple barebones (hah) Ball-and-chain Flexable bones simulation by having a dragged point which the joint would just look At.

Eventually I’ve planned on expanding upon it and creating a much more robust system with spriningyness between multiple joints so that the are laxing damping values the further one goes a chain of bones, and maybe even get affected by the environment (so that the points actually collide with something and effect the result on the bones).

I’ve gotten a rough Debug Tail working,
But when applied to the darn… bones…


(Last one is actually just me fooling around with values, not an actual result)

Could anyone help me figure this bone issue out?

You can also try the script:

is a script that rezes a debug ball-and-“chain” for you guys to run around with if you want to try it out, and if you have “Tail1” bone it should work attempt to animate it as well. It should at min last for 1 hour before the entities are erased, they as also named JointDebug* for easier deletion.


MyAvatar.setJointRotation() accepts rotations in relative to it’s parent.

So, in this case when you set the rotation on the Tail you have to take the lookAt vector you are computing in world space and transform it, I assume the tail is a child of the hips… so you could probably get away with multiplying by the inverse of the MyAvatar.rotation, with an extra 180 degree twist.

For what it’s worth, at some point we will have a better API, allowing you to set joints in the world frame and avatar frame as well. But right now, you have to do this manually.


Is it really? Intresting, I ll try it out.

Oh and if possible, could we at some point also be able to retrieve the structure of the bones? Right now I cant really define if something is a child of some other node.


Yes, great suggestion, we will have that API in the future. Currently, you have to know the skeleton structure beforehand.


Unfortunately that didnt directly work, The angle keeps flipping when I face another direction, indicating that some reference rotation is not getting fully canceled out. Need to figure out what exactly.


One issue could be that the Quat.lookAt() computation will put z forward, but for the tail bone you probably want it to point down the y axis.