Basic movement in Unity (script)

SO i am REALLY confused on how to make a script for movement as there is so many different approaches

And none seems to work :-/

Using W,A,S,D for basic movement in a 3D world , how hard can it be…

At this point i would have guessed there would be some basic scripts that people just use but no
Its a jungle!

I made a 3d World

Made a game object of 7 components

Now i just want to controle it (its a car)

So how to write a basic script for movement where W,A,S,D is used. And where can i learn it? rather just focus on one learning curve than a bounch of different ways ;-(

btw am totally newb

There are as many different ways to move as there are developers. But, try something like this.

public class BasicMover : MonoBehaviour {
    void Update() {
        transform.position += transform.forward * Input.GetAxis("Vertical");
    }
}

This should get you forward/backward movement; now see if you can add left/right movement too. Take it one step at a time and you’ll get there!

1 Like

For a good place to start, check out this tutorial from Unity Learn. It is a good introduction to how to get movement working (it’s 2D, but the same concepts apply to 3D, in 3D you just have to consider the z axis as well).