In my game I want the enemy to look at my character, which works but it is doing it on all of the axises. It is a 2D game so it won’t let me freeze the x and y axis. How can I fix this issue?
I’m haven’t done this in 2d, but in 3d if I want it to rotate around the y axis, I give the target.y, the transform.y. So I think you would do that for the z:
I should have included a proper message in that previous post of mine. There is a method called ‘Mathf.Rad2Deg’ in Unity which you can use.
Why that last line of code you posted doesn’t work is because you cannot assign to the ‘.z’ portion of that property; not for rotations, or any other struct property.
Did this 1 line of code not work for you?
If you look at the sprite, and the character is facing their right, does the sprite have to have a rotation to produce that?
It sounds like no rotation is not facing right at the moment.
I think he might just be looking on the wrong axis, here is an image of him in both my scene and gameplay. (The dog is the character and the enemy is guy)
No problem. I’m glad you found that solution on your own. It was because your sprite is not facing right by default. I guess, to be fair, so long as you choose 1 way and stick with it, that’s good enough. I mean, it’s probably easier to remember that way, is all.