Replace UpdateBone function in PoseUser script.
Honestly, I don't understand why it is because I don't know mathematics.
But it maybe works.
Additionally, change value of RotationDamping to 10.
Sensor must be able to see lower body.
Vector3.down is direction to desired joint joint from torso when T-pose state .
For example, if you want to use this to right arm, change Vector3.down to Vector3.right.
Vector3 GetPosition(Astra.Joint jo)
{
return new Vector3(jo.WorldPosition.X, jo.WorldPosition.Y, jo.WorldPosition.Z);
}
private void UpdateBone(Body body)
{
for (int i = 0; i < body.Joints.Length; ++i)
{
if (body.Joints[i].Type == JointType.LeftHip || body.Joints[i].Type == JointType.RightHip ||
body.Joints[i].Type == JointType.LeftKnee || body.Joints[i].Type == JointType.RightKnee)
{
Vector3 mainJointPos = GetPosition(body.Joints[i]);
Vector3 nextJointPos = GetPosition(body.Joints[i + 1]);
if (mainJointPos != Vector3.zero && nextJointPos != Vector3.zero)
_boneRotation[i] = Quaternion.LookRotation(nextJointPos - mainJointPos, nextJointPos - mainJointPos) * Quaternion.LookRotation(Vector3.zero - Vector3.down);
}
else
{
_boneRotation[i] = GetRotation(body.Joints[i]);
}
Joints[i].transform.rotation = _currentRotations[i] =
Quaternion.Slerp(_currentRotations[i], _boneRotation[i] * _initialRotations[i], Time.deltaTime * RotationDamping);
}
return;
}