Not changing WASD controls when character turns
Hello everyone. I am currently working on a top down game (dont know if shooter or what) This is just for learning, so i would like to use your guys assistance... So i made my player walk with WASD, and look at my mouse all the time. My problem now is that the direction he looks is always forward (W), but i would like north on the map to always be W, and not forward for him, how can i change that. Here is the code for the character looking at the mouse:
Ray cameraRay = mainCamera.ScreenPointToRay(Input.mousePosition);
Plane groundplane = new Plane(Vector3.up, Vector3.zero);
float rayLength;
if (groundplane.Raycast(cameraRay, out rayLength))
{
Vector3 pointToLook = cameraRay.GetPoint(rayLength);
Debug.DrawLine(cameraRay.origin, pointToLook, Color.blue);
transform.LookAt(new Vector3(pointToLook.x, transform.position.y, pointToLook.z));
}
please also let me know if there is anything useful i should know, i am completely new, and i would like to do this as much as possible without tutorials, but ofcourse i am willing to do what i need to learn. Thank you for your time.
Your answer
Follow this Question
Related Questions
How can I move my 2D car in 16 fixed angles like in Retro City Rampage 1 Answer
How can I make character accelerate and deccelerate using GetAxis? 0 Answers
Lerp ignores collision and allows player to move through a wall. 0 Answers
Resident Evil 4 Style Aiming Window - Rotational Problem When Aiming 1 Answer
when my character rotates the controls of the initial rotation stay and not change with it 0 Answers