- Home /
How do I create WASD controls for a fps?
Lol as you can see I am a noob when it comes to programing.... I haven't programmed at all.
I was wondering if anyone could help me out in creating WASD controls in a fps. It is in JavaScript. I can't read any of this programming writing and hopping that someone could help me out with it.
I can get the fps on the screen I can get the camera to move I just cant get it to move positions using WASD (as the forward, backward, side to side movement). Can someone help me!?
Thanks,
Dark
Answer by thendricks · Sep 09, 2012 at 01:11 PM
Unity has some fps scripts built in. All you have to do is import the package character controllers and apply the scripts fps input, character motor(found under character in components) and mouse look on the camera (for this you need to import the scripts package). Or you could go into character controllers and drag fps controller(prefab) into the scene view.
Answer by zerox911 · Sep 11, 2012 at 09:17 AM
what he said...
but to make it simple..
if(Input.GetAxis("Horizontal"){
(yourObject ).transform.Translate(Vector3.right Time.deltaTime (SPEED )); }
if(Input.GetAxis("Vertical"){
(yourObject).transform.Translate(Vector3.forward Time.deltaTime (SPEED));
}
the brackets ( *) is your variable..
or you could go to here http://docs.unity3d.com/Documentation/ScriptReference/
it will explain to u more..