# lock rotation of object on specific angle

I’m trying to make a object rotate at a specific speed to face another object, but as it is a 2D project I need to make the object only rotate at the Z angle.

``````myTransform.rotation = Quaternion.Slerp (myTransform.rotation, Quaternion.LookRotation (target.position - myTransform.position), rotationSpeed * Time.deltaTime)
``````

In this case, is it not sufficient to set the “up” argument of the look vector?

Quaternion.LookRotation(target.position-myTransform.position, Vector3.forward)

If that doesn’t work, bear in mind this approach to rotation requires target.position and myTransform.position are on a plane whose normal is the up vector (rotation axis) of your 2D system. This makes sense: Otherwise you’re asking for a vector pointing higher or lower than your 2D plane, and get a rotation which looks in that non-2D direction.

And unless I’m misremembering, Quat.Slerp can produce movement on unintended axes, even when 1 or 2 euler angles of the start / end rotations are identical. Lerp functions don’t share this particular quirk.