How to copy rotation along specific axis
Chunkeyninja
Posts: 7
Hi, am looking for a script which allows to copy rotation but only along the specified axis (x).
For context, am taking the rotation of a head binding, and applying that to an empty which I have parented some image layers to, and only want it to rotate on the axis facing the camera.
0
Answers
-
@Chunkeyninja
Have you searched for a template within Lens Studio that does this!0 -
There's hundreds of templates, any specific suggestion?
0 -
@Chunkeyninja Here is a script that you can use to copy the rotation of a head binding along the x-axis to an empty object with image layers parented to it:
// Replace "headBinding" with the name of your head binding object // Replace "emptyObject" with the name of your empty object const headBinding = Scene.getObjectByName("headBinding"); const emptyObject = Scene.getObjectByName("emptyObject"); // Get the x-axis rotation of the head binding const xRotation = headBinding.getTransform().rotation.x; // Set the x-axis rotation of the empty object emptyObject.getTransform().rotation.x = xRotation;
0