So, my map is sideways so I can use tilemaps. But, I have this enemy, works good, BUT it looks at me sideways as if I am not sideways, so the transform.lookAt will not work with sideways maps unless I modify the input by a certain number, but I tried and cannot get it to work. Any suggestions? Here is the lookAt code:
Vector3 lookAt = PlayerController.instance.transform.position;
lookAt.y = transform.position.y;
transform.LookAt(lookAt);
CodePudding user response:
I am not sure if I understand it correctly, but I propably had the same problem some time ago. You can make it work if you use transform.Forward or Quaternion rotation
CodePudding user response:
You can simply assign a value to Transform.right
or Transform.up
according to your needs like e.g.
Vector2 direction = PlayerController.instance.transform.position - transform.position;
transform.right = direction;