# Coding Python - Rotate object

Is there a way yet to apply transformations to objects using python? I want to rotate an object after it moves. The autofill doesn’t show transform and when I try to use the Api and do something like:

character.transform.rotateLocal(Vector3(0, 0, 0), 45)

nothing happens. Can anyone help with this or verify its not possible? Thank you.

John

1 Like

This is the solution:

girl1.transition.rotate_local(Vector3(0,0,-1), 3.14, 1.00)

Explanation: The first value, a Vector3, represents the axis on which it will rotate. Place a negative or positive 1 in each axis you want to rotate on. You can compound rotations for unique effects. The positive or negative determines the direction of the rotation. In my code I placed a -1 in the z axis so my character turns around in a clockwise direction.

The second value represents the amount of rotation in radians. I used the degrees to radians calculator on Google to determine that 3.14 radians will turn my character around 180 degrees.

The third value represents in seconds how long the turn will take.

I know this explanation is drawn out but I thought this was the clearest way to explain rotations as it took me awhile to figure this all out.

As a side note: Changing the radians from positive to negative also switches the direction of the rotation.

1 Like