modifying joint rotation
I want to copy the joint rotation from one bone to another. But I want to give it a smaller value.
so, I am getting the joint rotation by:
var joint1Transform = script.bone1.getWorldTransform();
var joint1Rotation = joint1Transform.getWorldRotation();
var joint2Transform = script.bone2.getWorldTransform();
joint2Transform.setWorldRotation(joint1Rotation);
this works, but how can I half the values? So that if joint 1 has a 30 degree rotation on Z, I put only 15 degrees on joint 2?
thanks,
Dale
I'm not familiar with joints, but i think this one will help you.
https://lensstudio.snapchat.com/api/classes/quat/
Well, atleast give you ideas.
Hi Dale,
Working in Euler angles can get messy and inconsistent, so you might have better luck working with quaternions. I'm not totally sure what you want to achieve, but doing something like this will rotate the second joint halfway between the first one and the identity quaternion (which has Euler angles 0,0,0):
Let me know if this works for you!
Jacob
Jacob,
that totally works and is basically where I ended up. Thank you.
thanks,
Dale
Hi Dale,
Happy to see the Snap community was able to help you out. Please let us know if you need any additional assistance!
Cheers,
Neha