How to move objects using WASD in Unity 2020

Поділитися
Вставка
  • Опубліковано 19 жов 2024

КОМЕНТАРІ • 382

  • @hyp3r_unii
    @hyp3r_unii 2 роки тому +8

    DUDE! From months searching about movement stuff.... From well produced videos to really not well produced videos, this one video is the FAR BEYOND the best and more efficient video i watched! Thx a LOT! subscribed with pleasure! Success!

  • @PapaSmurfVR862
    @PapaSmurfVR862 2 роки тому +6

    It’s like everyone you watch isn’t really doing a tutorial and just going through it but you actually did a good job explaining it and not typing so fast

  • @AGthechampion
    @AGthechampion 6 місяців тому

    Years down the line and it still works. Thank you. I've spent hours trying to work with a faulty script, but yours WORKS PERFECTLY.

  • @jellyjar1556
    @jellyjar1556 3 роки тому +5

    THANK YOU SOOO MUCH! YOUR TUTORIALS ARE IN FACT ALMOST AS GOOD AS BRACKEYS TUTORIALS BUT THE EXPLAINING IS SLIGHTLY BETTER THAN BRACKEYS

  • @CreepedByDark
    @CreepedByDark 2 роки тому +11

    u got my respect very nice and simple tutorial keep it up

  • @Jdp1909
    @Jdp1909 2 роки тому

    Every person, "Just gonna crtl + c then crtl + v. Hey thanks man for the tutorial!"

  • @clutchluna
    @clutchluna 2 роки тому +3

    thank you for doing this tutorial but Unity says Vector3 Cannot be used like a method

  • @siryeetsalot6129
    @siryeetsalot6129 3 роки тому +7

    OH MY GOSH THANKS SO MUCH! I HAVE BEEN TRYING TO GET MY PLAYER MOVEMENT UP AND RUNNING FOR SSOOO LONG!

    • @parryjerry8441
      @parryjerry8441 3 роки тому

      can u send me code pls? mine has so many errors!

    • @nanof2310
      @nanof2310 2 роки тому +1

      @@parryjerry8441 using UnityEngine;
      public class MovePlayer : MonoBehaviour
      {
      public float speed = .1f;
      // Update is called once per frame
      void Update()
      {
      float xDirection = Input.GetAxis("Horizontal");
      float zDirection = Input.GetAxis("Vertical");
      Vector3 moveDirection = new Vector3(xDirection, 0.0f, zDirection);
      transform.position += moveDirection * speed;
      }
      }

    • @ThePickleVR
      @ThePickleVR 2 роки тому

      same bro this never has worked but now it does

  • @MaxSparky
    @MaxSparky 3 роки тому

    gotta be the first programming/computer youtube video to start outside lol

  • @snowmaster2288
    @snowmaster2288 2 роки тому +5

    This is easily the the easiest tutorial to follow and its simple too!

  • @nathandobbyn8747
    @nathandobbyn8747 2 роки тому

    Thanks, I've been looking forever for this type of video

  • @bhavik5847
    @bhavik5847 2 роки тому +1

    Oh Thank you so much, that helped...
    But i have a doubt,
    dont we need to say the game that which buttons it shld use to go up and down, i mean does the game itself assumes that the movement keys for up and down are gonna be 'w' and 's' ??

  • @iamgeorgesears
    @iamgeorgesears 4 роки тому +9

    Great understandable tutorial!

  • @bombastian1232
    @bombastian1232 3 роки тому +1

    Im brand new to unity but still understood everything. Great video!

  • @karlhans6678
    @karlhans6678 3 роки тому +6

    Nice and simple tutorial. I have a few questions:
    1. is updating Unity free and a good idea? it might ruin projects.
    2. I haven't touched Unity in a while and used to open scripts with Visual Studio, but now Unity has its own script opener--MonoDevelop (tbh i like it, it loads fast and doesnt a lot of disk space) is it ok if i use this less powerful software instead of VS?
    3. can you make a pre-rendered background tutorial?

    • @shrit-th7go
      @shrit-th7go 3 роки тому +1

      i use jetbrains rider if not then visual studio because you are using a code editor for more nice input and nice coding practices thats why i use rider or vs because nice interfance and ALL YA KNOW.

  • @RubyPiec
    @RubyPiec 3 роки тому +8

    Important: add semicolons to the end of each line

  • @MikeHalk100
    @MikeHalk100 4 роки тому +8

    Would you do a tutorial on controlling player/ object speed with the mousewheel?

  • @satyadev2011
    @satyadev2011 2 роки тому +1

    Thank you sooooooooooooooooooo much!

  • @bluecoding2506
    @bluecoding2506 2 роки тому

    Thanks This Video Helped Me Alot!

  • @runarholberg162
    @runarholberg162 2 роки тому +2

    Great tutorial, I even got the script right too, thanks!

  • @oblivion4317
    @oblivion4317 3 роки тому +4

    if you turn on box collider you dont need the extra scripting to make it bump into things

  • @alimango991
    @alimango991 3 роки тому +1

    that helped more than the course i am in tysm

  • @vagg6078
    @vagg6078 3 роки тому +1

    Well icant click the play button it says all compiler errors have to be fixed before you enter the game

  • @islamicvideos56990
    @islamicvideos56990 3 роки тому

    Thankkk youuu only person who worked for me

  • @Star-sv4cj
    @Star-sv4cj 2 роки тому +1

    it says "all compiler errors must be fixed before you can click play" so yeah, this one aint working for me.
    edit: ended up rewriting the script and it works AMAZINGLY. Ty for this help

    • @izziakepic
      @izziakepic Рік тому

      I have same problem idk how to fix it

  • @AlexChessSRM
    @AlexChessSRM 2 роки тому +1

    Finally I got it thank you so much

  • @littlehomemadestudio2200
    @littlehomemadestudio2200 2 роки тому

    Hi there I am using unity 2021 is it go fine and also what is the best version of unity

  • @AlexCio
    @AlexCio Рік тому

    you‘re awesome man! ❤❤

  • @duanenso_freestyle
    @duanenso_freestyle 2 роки тому

    Amazing! Just add some first person camera, then it would be the best first person controller ever! Very simple, and this was 2 years ago, great Job! Subscribed and rang the bell. You deserve it.

  • @stormbreak7806
    @stormbreak7806 3 роки тому +7

    i get the error "the script don´t inherit a negative class that can manage a script" what to do?

    • @gjezel1963
      @gjezel1963 3 роки тому

      Me to

    • @pig3651
      @pig3651 3 роки тому +1

      @@gjezel1963 me to

    • @pig3651
      @pig3651 3 роки тому

      After research i found out that its a bug - so download older or newer version

    • @RiverLoveer
      @RiverLoveer 3 роки тому +5

      @Cute and Funny Pets Dude shut up people run into many problems while programming so if they run into a problem dont tell them to stop making games thats just being an absolute jackass

    • @lucidduck
      @lucidduck 3 роки тому

      me to

  • @mobylobster
    @mobylobster 2 роки тому +1

    i dont understand im trying to get a simple game down but when i type the exact same as u i get so many errors

  • @inifinidev3101
    @inifinidev3101 2 роки тому

    at 4:00 was the string value intentional or was it unnecessary (not tht it would change the script in any way)

  • @DeanBenjamin-k6q
    @DeanBenjamin-k6q 11 місяців тому +1

    didn't work for me, came up with four errors like vector 3 could not be found

  • @Dreadnor.
    @Dreadnor. 2 роки тому

    I don't understand how pressing wasd actually moves the cube? What the f did you actually do besides tell it to change position?

  • @beastNick7713
    @beastNick7713 Рік тому +1

    nice bro it helped me a lot i was trying to find a tutorial that my code doesnt tell me erros and i found it;

  • @reiko1945
    @reiko1945 2 роки тому

    u explained things so welllll tysm!!

  • @ghostly_lp8260
    @ghostly_lp8260 3 роки тому +1

    i done everything and when i press play my cube starts going to one side without me pressing anything please help and reply ASAP

  • @xdxdxdxpapapapa1056
    @xdxdxdxpapapapa1056 2 роки тому

    really nice videos, you r so great

  • @CubeFlow_46
    @CubeFlow_46 2 роки тому

    It won't let me add the script to the cube, says something about the script class not being found. Help?

  • @milesgaming1930
    @milesgaming1930 3 роки тому +20

    How is he staring into my soul

  • @cactigaming50
    @cactigaming50 Рік тому +2

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class playerMovement : MonoBehaviour
    {
    // Update is called once per frame
    void FixedUpdate()
    {
    float xDirection = Input.GetAxis("Horizontal");
    float zDirection = Input.GetAxis("Vertical");
    Vector3 moveDirection = new Vector3(xDirection, 0.0f, zDirection);
    transform.position += moveDirection;
    }
    }

  • @dwag2727
    @dwag2727 4 роки тому +4

    Help, i have 2 "the name input does not exist in the current context" and one "an object reference is required for the non static field, or or property 'transform.position'" i have these things in the command, and cant start the game

    • @hamodyksa2614
      @hamodyksa2614 3 роки тому

      its Input not input
      "I"

    • @dwag2727
      @dwag2727 3 роки тому

      @@hamodyksa2614 متأخر شوي بس خلاص حليت المشكله شكرا

    • @usalty6010
      @usalty6010 3 роки тому

      @@dwag2727 Google translation: A little late, but I solved the problem, thank you

  • @gamincake_official
    @gamincake_official 2 роки тому

    tyyyyy so much for my first 3d project :))))))))))))))))))))

  • @stopmotionkid6313
    @stopmotionkid6313 3 роки тому +1

    when I press play it says All compiler errors have to be fixed before you can enter playmode

  • @Maxdaperson
    @Maxdaperson Рік тому +1

    i did the exact same thing and it didn't work their are no issues with the code and it plays i just don't have it moving and don't understand how this makes it move with wasd
    if you want to know im using a mac with unity 2021.3.14f1 and visual studio code

  • @johncuozzo4021
    @johncuozzo4021 Рік тому

    thanks but I'm looking on how to move foward and back but rotate left when turning left and vise verse

  • @PriestessOfDada
    @PriestessOfDada 2 роки тому

    This was really helpful, thanks

  • @matthew12438
    @matthew12438 3 роки тому +1

    it gives me an error message when i press play "all compiler errors have to be fixed before you can enter playmode"

  • @TheSmokeinator
    @TheSmokeinator 2 роки тому

    if you use a rigidbody on the cube, what will happen? will it fall? will it not move at all?

  • @roofbear7069
    @roofbear7069 2 роки тому

    Thank you so much, I was following another tutorial from another user only to find out that Unity change context and I was missing "float".

  • @Rubkinz
    @Rubkinz 2 роки тому

    i havent linked anything but i do have visual studio, so can i just go on withought it open?

  • @nipzipz208
    @nipzipz208 2 роки тому

    Im new to unity and i want my game to be single player to multiplayer if im going to make this into multiplayer will this be only in your character or it wont work in multi player like when you press w the other player will also move to w but which is a problem if that happens

  • @rehanmalik6535
    @rehanmalik6535 Рік тому

    can somebody tell me i keep getting the error "Transform' does not contain a definition for 'Position' and no accessible extension method 'Position' accepting a first argument of type 'Transform' could be found (are you missing a using directive or an assembly reference?)" i spent so much time searching for some misstake but i can not find it ?

  • @hadouchiken3685
    @hadouchiken3685 3 роки тому +1

    I dont have that code prediction you have in Visual Studio.. Any idea how to enable them?

  • @tamasorvos8882
    @tamasorvos8882 2 роки тому

    Thank you, great tutorial!

  • @harshasuresh4062
    @harshasuresh4062 2 роки тому

    Thank you very very much!!

  • @ANILWALVI4476
    @ANILWALVI4476 2 роки тому

    Very Helpful

  • @Henolis
    @Henolis 2 роки тому +1

    I can't move the script to the cube i have no ídea why... :(

  • @KingKhanRaheel
    @KingKhanRaheel 3 роки тому +1

    I just wanted movement in the x axis But thank god Your script worked after making some changes....
    my previous script was interfering with constant speed because i used a character controller........
    THANK YOU!!!!!!

  • @FiceZ_
    @FiceZ_ 3 роки тому +1

    Thanks!

  • @autgui06
    @autgui06 2 роки тому

    why doesn't my VS show suggestions and if I use the ctrl+space the suggestions don't show anything good and most of the time it says that there are no suggestions, what to do?

  • @joshawafrith4797
    @joshawafrith4797 3 роки тому +1

    so i tired this and it dosnt work? idk this is my first time using unity and visual studio. it dosnt highlight "moveDirection", "GetAxis" or "Vector3" and when i saved it and tryed to play it the start button wont work

    • @trevorsentz2385
      @trevorsentz2385 3 роки тому

      same here if any one has a solution or what addons i need please tell me

  • @jcthedumb3930
    @jcthedumb3930 3 роки тому +3

    I got an error saying “The script ‘Movement’ does not contain a class derived from UnityEngine.MonoBehaviour”
    Anyone know how to help?

    • @swaysix
      @swaysix 3 роки тому

      Delete the sript and try again i was doing it again and i did it and t worked

  • @anlkurul8315
    @anlkurul8315 3 роки тому +1

    I have an error that says The referenced script on this Behaviour (Game object playing) is missing !
    What I should do

    • @anlkurul8315
      @anlkurul8315 3 роки тому +1

      another error
      :( UnityException: GetAxis is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'mover' on game object 'playing'.
      See "Script Serialization" page in the Unity Manual for further details.
      mover..ctor () (at Assets/scripts/mover.cs:6)

    • @anlkurul8315
      @anlkurul8315 3 роки тому +1

      and it says associated script cannot be loaded what

  • @chefpeepeeinc2896
    @chefpeepeeinc2896 3 роки тому +2

    What? It says Error, transform does not contain a definition for position.

    • @cyborgsgaming5883
      @cyborgsgaming5883 3 роки тому

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class PlayerController : MonoBehaviour
      {
      public float speed = .1f;
      void Update()
      {
      float xDirection = Input.GetAxis("Horizontal");
      float zDirection = Input.GetAxis("Vertical");
      Vector3 moveDirection = new Vector3(xDirection, 0.0f , zDirection);
      transform.position += moveDirection * speed;
      }
      }

  • @Rustyskittles
    @Rustyskittles 2 роки тому

    for some reason when i try to click the play button it says Assets\movement.cs(11,24): error CS0103: The name 'input' does not exist in the current context please tell me what to do i have been trying to get it to work for like 2 hours i subscribed pls help

  • @stevenaninon5653
    @stevenaninon5653 3 роки тому

    Thanks man. Very helpful

  • @yashsoni553
    @yashsoni553 3 роки тому +1

    please explain how to fix the problem:- when you write the script and apply it and then run it, it works but when you rotate the camera with another script you have a problem controlling keys like if you rotate the player you will need to click the downside pointing arrow to go front

    • @lucidduck
      @lucidduck 3 роки тому +2

      using UnityEngine;
      public class movmeent : MonoBehaviour
      {
      // Update is called once per frame
      void Update()
      {
      float xDirection = input.Getaxis("horizontal");
      float zDirection input.Getaxis("vertical");
      vector3 movedirection = new vector3(xdirection, 0.0f zdirection);
      tansfrom.position += movedirection;
      }
      }

  • @rost5821
    @rost5821 3 роки тому +1

    So for some reason when I’m on part to control the speed I wrote everything that was showed but I didn’t pop up in unity
    CAN SOMEONE HELP please I’m a beginner

  • @ARandomHumanBein
    @ARandomHumanBein 2 роки тому

    Help "Input.GetAxis("Horizontal") doesn't work on the latest unity version

  • @silverpaucar2463
    @silverpaucar2463 3 роки тому +1

    Why does it say Can’t add script component ‘Move cube’ because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match. Please help

  • @omgimnot6738
    @omgimnot6738 3 роки тому

    Thank you very much!

  • @OlegDemidovich1997
    @OlegDemidovich1997 4 роки тому +1

    Hi! I want to make a keyboard on the computer open "A+W+D". But you need to close one "S".

    • @OlegDemidovich1997
      @OlegDemidovich1997 4 роки тому +1

      Here's how to do you want to remove the "S"

    • @SorcererStudios
      @SorcererStudios  4 роки тому +1

      I would check the "Vertical" float of Input.GetAxis. If "Vertical" is less than 0, then make it 0. That would remove the S.

  • @chazzabfc
    @chazzabfc 3 роки тому +1

    I need to fix my compiler errors before I can play????? I’ve got errors

  • @matemat4640
    @matemat4640 4 роки тому +4

    Thank´s Man you hellped me a lot iam just 12 but i hope it gonna be fun :)

  • @pugifeidgamer996
    @pugifeidgamer996 2 роки тому

    for some reason
    this script is not working
    using UnityEngine;
    public class NewBehaviourScript : MonoBehaviour
    {
    // Start is called before the first frame update
    // Update is called once per frame
    void Update()
    {
    float xDirection = Input.GetAxis("Horizontal");
    float zDirection = Input.GetAxis("Vertical");
    Vector3 moverDirection = new Vector3(xDirection, 0.0f, zDirection);
    transfrom.position += moveDirection;
    }
    }
    The error said the moveDirection does not exist in current context.
    Do you know how to fix this?

    • @Llamu
      @Llamu 2 роки тому +1

      in line 3 make sure ut says whatever you named the file instead of "NewBehaviourScript"
      for example: public class *MoveCube* : MonoBehaviour

    • @pugifeidgamer996
      @pugifeidgamer996 2 роки тому

      @@Llamu Thank you

  • @madhavitalhar6704
    @madhavitalhar6704 3 роки тому

    Which keyboard keys do you use to move player

  • @kyloo2340
    @kyloo2340 3 роки тому

    how to setup visual studio to hints code and highlight it in color? in my editor for example Vector3 is not hinting while typing and stays white

  • @jasonbenusik672
    @jasonbenusik672 2 роки тому

    please do jump with space tutorial

  • @andreassiegismund7064
    @andreassiegismund7064 2 роки тому

    omg i thank you so much!!!

  • @midorogurin
    @midorogurin 2 роки тому

    would there be any way to make the model have an animation when it moves, and another animation when it's not moving?
    also, is there a way to make the camera follow the model?

    • @u4r1a46
      @u4r1a46 2 роки тому

      @EXGR1TTY this works, but the movement axis doesn't change. so if I turned my character then forward wouldn't change and 'W' would bring me left or smth. do you have a fix?

  • @Mus1im__Goat
    @Mus1im__Goat 2 роки тому

    thank you sooooooo much !!!!

  • @mranimated6716
    @mranimated6716 3 роки тому

    I'm gonna subscribe you help me alot

  • @gmodify9568
    @gmodify9568 2 роки тому

    Hey for some reason when putting the script onto the cube it says “Can’t add script behaviour CallbackExecutor. The script needs to derive from MonoBehaviour”

  • @portalmaster1814
    @portalmaster1814 3 роки тому +1

    why did this not work for me idk but what version did u do this on so we can do it just in the right V

    • @cyborgsgaming5883
      @cyborgsgaming5883 3 роки тому

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class PlayerController : MonoBehaviour
      {
      public float speed = .1f;
      void Update()
      {
      float xDirection = Input.GetAxis("Horizontal");
      float zDirection = Input.GetAxis("Vertical");
      Vector3 moveDirection = new Vector3(xDirection, 0.0f , zDirection);
      transform.position += moveDirection * speed;
      }
      }

  • @kaizenit6470
    @kaizenit6470 3 роки тому

    When i type "Horizontal" and "Vertical" it gets red and it pops up an error now i dont know what to do

  • @Juteplant
    @Juteplant 3 роки тому +1

    this guy is like the god of tutorials.

  • @dog9w234
    @dog9w234 3 роки тому

    I am getting "Can't add script component 'MoveCube' because the script class cannot be found..." I have the class name set to "MoveCube" and the filename is "MoveCube", what is going on?

  • @mateuszbiaas1559
    @mateuszbiaas1559 3 роки тому +1

    Oh my god... why u declarate variables in each frame? It's terrible. Why should it trigger every frame if the player sometimes doesn't want to move? "transform.position" should be in some 'if'. Like 'if (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0)'. One more - movement should be in function 'FixedUpdate'.

  • @crujoe
    @crujoe 3 роки тому +3

    using UnityEngine;
    public class SCRIPTNAMEHERE : MonoBehaviour
    {
    public float speed = .1f;
    // Update is called once per frame
    void Update()
    {
    float xDirection = Input.GetAxis("Horizontal");
    float zDirection = Input.GetAxis("Vertical");
    Vector3 moveDirection = new Vector3(xDirection, 0.0f, zDirection);
    transform.position += moveDirection * speed;
    }
    }

  • @PrinceOwen-yk3wy
    @PrinceOwen-yk3wy 3 роки тому

    Thank u so much

  • @Scre1mingcat
    @Scre1mingcat 4 роки тому

    Where can you get the scripting program not unity but the other one can you send me the link to get it? Please

  • @R69Games
    @R69Games 3 роки тому

    Wow, lovely Tutorial so nice explain it, Thank you buddy :)

  • @ThePickleVR
    @ThePickleVR 2 роки тому

    how do you make it so you can jump?

  • @NubianQueenVibe
    @NubianQueenVibe 3 роки тому

    Thank you

  • @keithpatience74
    @keithpatience74 2 роки тому

    my directions are inverted. Any fixes for this ?

  • @trashmasterchess449
    @trashmasterchess449 3 роки тому +1

    it works thank u so much! =)

  • @chilzyhalo7475
    @chilzyhalo7475 3 роки тому +3

    could you post the script?

  • @TCT100
    @TCT100 3 роки тому

    If i write an Script like this with Microsoft Visual Studio 2019 ans try to write "Input" it can't be found. Also it happend with "Get.Axis" and "Vector".
    If i open a new script, "MonoBehavier" have no marker/ color.
    I don't know what there happened.

    • @adambetts4957
      @adambetts4957 3 роки тому

      Make sure you're using GetAxis and not Get.Axis because Get.Axis doesn't exist. Also, you might need to install the C# for Unity Add-On for Visual Studio 2019.

    • @TCT100
      @TCT100 3 роки тому

      @@adambetts4957 thanks for Help.

  • @jacobazarias
    @jacobazarias 4 роки тому +2

    can you make a jumping tutorial and double jump

    • @SorcererStudios
      @SorcererStudios  4 роки тому +2

      Ill consider it!

    • @elizabethm78
      @elizabethm78 3 роки тому +1

      @@SorcererStudios plz help i did tutorial and it dos nothing