Hello, I have a question about controlling and object. I want to use WASD to control an object from a 2D perspective (so when W is pressed the object moves up, S down, etc.), I know how to position the camera in the right place, but how would I control the movement?
This will move an object depending on its rotation:
float Speed = 15;
if(Inptu.GetKey(KeyCode.W)
transform.position += transform.forward * Speed; //or transform.up * Speed
else if(Inptu.GetKey(KeyCode.S)
transform.position += transform.forward * -Speed; //or transform.up * -Speed
if(Inptu.GetKey(KeyCode.A)
transform.position += transform.right * -Speed;
else if(Inptu.GetKey(KeyCode.D)
transform.position += transform.right * Speed;
you could also add the first person prefab controller to your scene and disable the mouselook script. then place your camera wherever you want and hit play. the camera will remain in the same position, based on weather or not you move the character using awsd. hope this helps.
shawn