How do I get something to rotate to face something else on the z axis? Say I'm using the default unity 2d settings, where x and y are the planes I'm using. Now say I want an object to rotate to face the players position, using only the z axis for rotation. How exactly would I get this to work? I've tried both "change rotation" and "rotate to" and neither seems to allow only rotating on the z axis to face an object. At this point I'm pretty stumped.
  • You can e.g. use a Rotate To node using the Lock Rotation setting to block rotation on the axes you don't want (X and Y).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Sorry for the late response, I was away from my computer for a few days. If I lock the x and y rotation then it doesn't rotate at all, it just stays still. It seems like the issue is when an object is rotated towards a target, it wants to rotate it so the objects z axis is facing towards the target. However in a 2D game z axis rotation will make the sprite look wierd. So I want to rotate it so an objects x axis is facing the target. How would I be able to go about doing this?
  • Well, the Z axis doesn't really to much when looking at another game object, this is pretty much only done on the X and Y axes.

    If you only want to rotate on the X axis, lock the Y and Z axes.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.