Unity movement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Unity movement

May someone assist with some 3D movement for Unity in C#?

7th Mar 2020, 3:40 PM
Samuel Mubukwanu
Samuel Mubukwanu - avatar
1 Answer
0
public void Update(){ if(Input.GetKey("d")){ var Movement = transform.position; Movement.x += 0.9f; transform.position = Movement; } else if(Input.GetKey("a")){ var Movement = transform.position; Movement.x -= 0.9f; transform.position = Movement; } } Its just a basic example of movement, put this code on Update method and insert the script on Character Object inside the scene
7th Mar 2020, 4:13 PM
Wardy Spirit
Wardy Spirit - avatar