Getting the face direction

I am now working on a 2.5D platformer and i am trying to find a way to find out in which direction the character is looking. Consider this, I am using touchpads to move the character.

I have a gameobject called crosshairGO. Its rotation represents where the character is looking and its position where the character is standing. If i touch the lower left part of the touchpad i want the character to look to the lower left. Any ideas on how to do that?

To determine the direction that your character is facing, try Transform.forward.

To rotate an object based on the position of another gameObject, try Transform.LookAt like so:

Transform.LookAt(crosshairGO.transform.position);

Did that help? I’m not sure if that’s what you wanted.

Klep

The problem is we don’t have a second object to look at. We are are using the joystick to try and determine where the charater is aiming.