Target Manipulator Rotation Axis


#1

Hello,

I have the target manipulator working such that I can swipe left and right and my 3D object rotates. The only problem is it’s rotating around the blue Z-axis for my 3D object, rather than the green Y-axis.

How do I set which rotation axis the Target Manipulator uses for rotation?

Thank you!


#2

Hi @TomR!

You can set the axis by double clicking into the Target Manipulator symbol and editing the Rotate and Scale script :smile:

To change the axis of rotation, open the Rotate and Scale script and then head to lines 83-87. Copy and paste the +rotationAmount variable to one of the three rotationVector arrays. For reference, [0] is the X axis, [1] is the Y axis and [2] is the Z axis. By default, the symbol is set up like this:

// Update the Z-rotation of the object with the difference between this frame and the last
GroupToModify.rotation([rotationVector[0],
	                    rotationVector[1],
	                    rotationVector[2]+rotationAmount]);

As a handy tip - you should always be able to find import and modification notes for our templates and subsymbols by clicking on the hamburger in the Hierarchy panel :memo:

In case anybody is wondering, we also have a general Target Manipulator article here as well as a more in-depth look at the script here!

Have a great day,
Francesca :blush: