- Home /
I am trying to make a movement script for my main camera but it isnt working!
if(Input.GetButton("Left")) { transform.eulerAngles.y +- -turnSpeed Time.deltaTime; } if(Input.GetButton("Right")) { transform.eulerAngles.y +- turnSpeed Time.deltaTime; }
I may be able to help you with a movement script for your camera although I need a bit more detail on what your game will be like for example (2D on X,Y axis) or (Top-Down X,Z axis) or a (3D Fps like spectator) I have made scripts for camera movement before; I just need you to help me help you by providing a bit more detail. I will periodically check this question to help as best I can.
Answer by Montraydavis · Oct 29, 2012 at 12:50 AM
var MoveDirection : Vector3 = Vector3.zero;
var PlayerSpeed : float = 3 ;
MoveDirection = Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical") );
MoveDirection = (transform.TransformDirection ( MoveDirection )*PlayerSpeed)*Time.deltaTime;
transform.position += MoveDirection ;
With the above, you will be able to move around in whichever direction you specify . Obviously, you need to change values for left,right