FPS Control script problem
So, I have a problem that has arised. Before I updated Unity, my script was working perfectly, and all of a sudden, when I start up the game-view test, the character will automatically start walking to the forward/left angle.
Here is the script, anyone know what could be going on?
public float speed;
public void Update () {
float forwardBack = Input.GetAxis ("Vertical") * speed;
float strafe = Input.GetAxis ("Horizontal") * speed;
forwardBack *= Time.deltaTime;
strafe *= Time.deltaTime;
transform.Translate (strafe, 0, forwardBack);
}
Thank you for the help, I have checked everything I can think of, and I have no idea what's going wrong.
I don't know if this will fix it, but you may want to do something like this. It will make sure that the script has a set variable for each, and it will make everything a bit easier on the editor, by making it have a higher FPS count, asf. You may also want to go to Edit>Player Preferences (it think, hunt around until you find)>Input. $$anonymous$$ake sure your "Vertical" and "Horizontal" are all set to the right things, and you don't have any other keys that can control movement.
public float speed;
float fowardBack;
float strafe;
public void Update () {
forwardBack = Input.GetAxis ("Vertical") * speed;
strafe = Input.GetAxis ("Horizontal") * speed;
forwardBack *= Time.deltaTime;
strafe *= Time.deltaTime;
transform.Translate (strafe, 0, forwardBack);
}
Your answer
Follow this Question
Related Questions
How to rotate RigidBodyFPSController (C#) 1 Answer
How can I add a toggle to this FPS counter script? 1 Answer
Generating random points and instantiating prefabs with a set distance 0 Answers
How to set a variable of a non-monobehavior script from a monobehaviour script 0 Answers
I create material with script but it does not render right 0 Answers