Set joint translation without stretch


I am working on the high fidelity development now and I face a problem about the avatar API. I have got the API like this ‘MyAvatar. setJointTranslation(“Neck”, {x: 0, y: 25, z: 0})’ from the DSL and it can stretch the avatar’s neck by set y = 25. my question is :slightly_smiling_face:

  1. How can I avoid to stretch the avatar’s neck or arm when I set this point. Do I need to set all of the Joint data to make sure the avatar seems more natural?
  2. Can I use this API to set some pose to avatar such as ‘sit down’ or ‘underarm’?
  3. Is there any rule to set the group of these joint points together?

Looking forward to your reply. Thanks all of you!


If you want to restore joint Data you can always run


Which will restore the joint back to its original State.
Alternatively, you have


That cleans all the joints.

  1. The point of the setJoint* data is to have the ability to set them to what ever. This is forexample useful when creating stuff like what the Flow App does with simulated physics. The constraints are upto the script that does the action. Now moving these around from their origins isnt really usual, but you can do quite a bit of stuff, like stretching movement or other funky stuff. The constraints them selves have to be build into the script is self (so youll have to do some math to it). So because you are moving two points separate, it will stretch. Instead if you want to avoid stretching, simply use rotate. Translate literally moves the bones to an offset.

  2. Yes. Not just that, but you can also simulate physical stuff with it, see flow app. that allows one to animate bones like hair / ears / tails

  1. No other rules but
    A. Joint count: The more joints the more likely the joint data isnt streamed to everyone, meaning people will see you in a stuck animation. We estimate this to be around 110-120 bones.
    B. Joint Distance: Joints further than 30 m wont get transmitted to others, so they will appear as if they were in place.

Note: IIRC, the joint translation data is in cm, not in meters.


Hi Menithal, Thank you so much for your reply. Actually what I am going to do is to set the each skeleton joint point with specific value. For example if I use this API ‘MyAvatar. setJointTranslation(“Neck”, {x: 0, y: 25, z: 0})’, the neck will stretch. How can I set the value of y to make sure the Neck will not stretch. For the Vec3, I am not sure the range of this three values. It seems like sometimes it is in range(0, 255) and sometimes(when I get the defalut joint data by API) in (0, 1). If I just want to create a motion just by setJointTranslation(). For example, the default pose is stand and the second pose is underarm, how can I set the point value just by the setJointTranslation() API? Thank you again!


If you want to pose something to a seated position then I suggest using the rotation, not translation. Or alternatively use IK to solve a chains rotation.

Translation literally moves something in the vec3, the axis ranges can be any number including negatives, and is not limited to 0-255 as it is a signed double.

So if you say your spine is at point A (0,-2,0), and your neck is at point B (0,10,0) you have a distance of 12 units between the two points.

If you have mesh weighted to the points it will stretch to accomidate It does not take any account to the bones preceding it, only what are parented to it

It also naturally behaves as a joint Offset, thus the behavior.

Instead what you want to use is setJointRotation which accept a Quaternion, and using Quaternion rotate joints to avoid stretch

MyAvatar.setJointRotation(‘Neck’, Quat.fromPitchYawRollDegrees(0.0, 0.0, 25.0));

Then you can use

MyAvatar.setJointTranslation(‘Hips’, vector);

To set the hips offset to what you want (as hips are parent to all)


Thank you so much! ‘The hips are parent to all’ helps a lot. As the figure above, I set the ‘RightLeg’, ‘RIghtUpLeg’, ‘LeftLeg’ and ‘LeftUpLeg’ to 90 by setJointRotation(). As you mentioned, then I need to use
MyAvatar.setJointTranslation(‘Hips’, vector);
The prolem is:
If I want the avatar’s feet on the floor, not let the avatar ‘fly’. How can I set the ‘Hips’ translation vector. Is there any API that can keep the avatars feet on the floor or I can get the distance between the avatar and floor.
Thanks Again!


Hi Menithal,

Could you help me with this problem? Is there any reference point which can help me calculate the distance between the avatar’s feet and floor? As you mentioned before, I can use the setJointTranslation to set the Hips, how can I get the avatars distance to floor when the avatar is ‘flying’?
Thank you so much! Looking forward to your reply!