First Person Movement Unity 2022

Поделиться
HTML-код
  • Опубликовано: 7 окт 2022
  • Todays video is all about making a fun to use and highly tweakable 3D movement system in unity.
    First Person Movement Unity 2022
    Code:
    pastebin.com/dcZVj1cB
    Remember to subscribe and hit that bell to always stay notified.
    Go check out my other videos:
    / bloxydev
  • ИгрыИгры

Комментарии • 238

  • @BloxyDev
    @BloxyDev  Год назад +16

    comment below what you though of the video and what I can improve on and don't be afraid to give me suggestions for future videos!

    • @kushals.p1267
      @kushals.p1267 Год назад +1

      Can i use version 2020.3.24f1

    • @BasicCheats
      @BasicCheats Год назад +1

      i loved the video so much thx bro this is working way to good

    • @LoFiMonk
      @LoFiMonk Год назад +1

      It's a great video. I'd like to see a tutorial like this with the new input system

    • @Quote_Quests
      @Quote_Quests Год назад +2

      Pls make a video on creating an enemy AI I cant really figure it out!

    • @Quote_Quests
      @Quote_Quests Год назад +2

      btw this was the most detailed video Ive seen for my new project- thanks :)

  • @LuckyEcho
    @LuckyEcho 5 месяцев назад +12

    Why is it always the small youtubers who make better content than the big ones? Good job, this helped a lot.

  • @alexfallingdown_9969
    @alexfallingdown_9969 29 дней назад +3

    Ive been trying to do this for HOURS looking at way to complicated "beginner" tutorials. This is an amazing tutorial and i will be recommending it to all of my coding friends. W

  • @bskt__
    @bskt__ 11 месяцев назад +2

    bro you video is PERFECT! i'm begginer and i been working on it for 4h with alot of bugs etc. searching through alot of tutorial but none worked, and i found your video, YOU SAVED MY LIFE MAN, keep it up!!!

  • @toast9092
    @toast9092 6 месяцев назад

    I have come across many player controller tutorials in my time and this was the only one that worked. So thank you!

  • @Firefox-hw3co
    @Firefox-hw3co Год назад +1

    Thank you soooo much!!! This helped a lot. Unity's FPS setup had my character rotation side to side all shakey. Ur tutorial sorted it out one time!!!

  • @Wreckk_
    @Wreckk_ Год назад +22

    FOR THE PEOPLE WHOS JUMP FUNCTION WONT WORK, YOU SELECT BOTH THE NEW GROUND LAYER YOU MADE AND THE DEFAULT LAYER AS WELL, good luck on your game.

  • @ecayeta
    @ecayeta 10 месяцев назад +4

    For all of those who don't know, you're not supposed to select both Default and Ground in the Player script, you're supposed to designate the objects on the map that are the floor and assign them to the Ground layer.

  • @nerbsquid
    @nerbsquid 9 месяцев назад

    this was overrall the best tutorial on character controller movement, Thank you so much!

  • @Shimneydust
    @Shimneydust Год назад

    I have watched like 4 diffrient movement tutorials, some didnt even work but this was the best.

  • @kudenokkaelain6026
    @kudenokkaelain6026 Месяц назад +1

    First actually GOOD tutorial I found. Amazing work.

  • @rekkimaru7
    @rekkimaru7 Год назад +8

    Been stumbling through a lot of character controller tutorials. There was always something off (like being catapulted into space when jumping on ramps and edges).
    Can't wait to try this one out! Keep up the good work!

    • @BloxyDev
      @BloxyDev  Год назад +2

      Well I'm glad I could help!

  • @IDKRipley
    @IDKRipley 9 месяцев назад

    Works in 2023! Very helpful video much appreciated

  • @supermelon80
    @supermelon80 Год назад

    This tutorial helped ALOT. Thanks for helping!

  • @rotemoron8213
    @rotemoron8213 Год назад

    Thank you so much, I had so much trouble but this video literally solved all my problems, subed and liked.

  • @beefytime1374
    @beefytime1374 Год назад +1

    Only one thats worked for me in like 5 tries, LOVE YOU SOOO MUUUUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! THANKYOUUUU

  • @IllyaMorgun
    @IllyaMorgun Год назад +8

    Here are a couple fixes for the jumping and other issues:
    1. Line 73 ; since the product of gravity (negative), and 2 (positive) is a positive integer we must subtract it from velocityY.
    My personal fix was : " velocityY -= gravity * -2.0f * Time.deltaTime "
    2. velocity (Vector3) and velocityY are basically the same so you could change velocityY to velocity.y; and the rest of the script respectively.

    • @Mistyre
      @Mistyre 11 месяцев назад +1

      @@DriplordVR Inside the Player, go into "Movement (script)", on the Ground section you select the "ground" layer and the "Default" layer

    • @akirayo4168
      @akirayo4168 11 месяцев назад

      How about [serializeField] issue? Can you help me?

    • @TheMultiversalDip
      @TheMultiversalDip 9 месяцев назад

      Holy smokes thats better, mine before was snapping when I fell of something. The only problem I'm getting is now I'm floating a lil' bit but I think I know how to fix that

    • @Al-tt6tj
      @Al-tt6tj 6 месяцев назад

      also change isGrounded! to !isGrounded. to fix jumping on slopes

  • @TristinDontKnowYou
    @TristinDontKnowYou Год назад

    That you so much man I been trying to do it for a while until I found this wonderful video-Thanks so much 🎉🎉🎉

  • @demizx
    @demizx Год назад +4

    bro is underrated , nice video

  • @alnonimo18
    @alnonimo18 8 месяцев назад

    THANK U SO MUCH! This was the only tutorial that really helped me

  • @raptorclawVR
    @raptorclawVR 2 месяца назад

    This tutorial was amazing, thank you so much!!!!

  • @benrafter7902
    @benrafter7902 11 месяцев назад

    Short and sweet, thank you!

  • @runrajrun
    @runrajrun Год назад

    I've been looking for a 1st person character controller for ages and yours is by far the best one I have come across in terms of ease of use! Thanks a ton :D
    Also more tutorials coming hopefully?!

  • @BMCJuicyG
    @BMCJuicyG 5 месяцев назад +2

    One last chicken very crispy

  • @briosh.mp4
    @briosh.mp4 Год назад +1

    TYSM for your help :) and I do a platform game but when I fall without jumping, my character falls very quickly to the ground but if I fall while jumping, it falls normally

  • @gquarkie1073
    @gquarkie1073 3 месяца назад

    Thank you so much, you helped alot!

  • @OfficialKaiVerse
    @OfficialKaiVerse 7 месяцев назад +2

    I have encountered a Glitch I can jump whilst in air causing to fly as long as you keep clicking Space if you keep clicking it then you stop for even a second you will have to wait till you touch the floor again.

  • @Insertmorecoins1
    @Insertmorecoins1 Месяц назад

    Great great video, my dude

  • @Aovri
    @Aovri 5 месяцев назад +1

    Bloxy Dev could I have some help I am trying to modify your code for a controller It already works with moving but I want to be able to look with right joy stick and jump with the east button also could it be modified to crouch with left joystick click down please help if you can Aovri

  • @sneakysquid-tt3ef
    @sneakysquid-tt3ef 9 месяцев назад

    THANK YOU SO MUCH OMG I FINALY AFTER SO MANY TRYS YOU HELPED ME AND GOT IT TO WORK YESS😁😁😀😀

  • @felixkostur723
    @felixkostur723 9 месяцев назад

    Thx I have been looking for a tutorial thats works for the walking script and the camera You earned a subscriber from me. Im suprised that it only got 670 when it shued of hade like 3-4 thousand Likes it was a Great tutorial. :)

  • @Jakob2OfKultvija
    @Jakob2OfKultvija Год назад

    Thank you so much , it worked!!!

  • @Dagame_time2Team
    @Dagame_time2Team 2 месяца назад

    dude I havent even opened Unity yet and its finally the same version LETS GO!!!!!!!!!!!!!!!

  • @PACKY22
    @PACKY22 11 месяцев назад +1

    when i press play than it just says all complier errors have to be fixed. what do i do to fix that?

  • @pappermcflapper5329
    @pappermcflapper5329 Год назад +1

    could you do a video on how to add guns and reloading i'm making a game and it would help a bunch

  • @Arrzee.
    @Arrzee. Год назад +14

    *FOR THE PEOPLE WHOS JUMP PORTION DOESNT WORK READ THIS MESSAGE*
    Inside the Player, go into "Movement", on the Ground you select the "ground" layer and the "Default" layer
    I hope this helps

    • @Mistyre
      @Mistyre 11 месяцев назад +2

      YOOOO MAN THX SOO MUCH

    • @MZentertainment206
      @MZentertainment206 11 месяцев назад +1

      ty sooo mutch broo i was legit getting concernd

    • @Chrono-Science
      @Chrono-Science 11 месяцев назад

      You're the best

    • @Arrzee.
      @Arrzee. 11 месяцев назад +1

      @@Chrono-Science I know 😎

    • @jimpix1008
      @jimpix1008 10 месяцев назад

      Thank you so much!!!!!

  • @Takhooo
    @Takhooo Год назад

    Do you have any Idea how to make it so you can jump while running on a downslope ?

  • @NotWez_
    @NotWez_ 7 месяцев назад

    wow amazing so easy and I will make sure to remember this

  • @FactuallyWOW
    @FactuallyWOW 10 месяцев назад +1

    bruh mine doesnt jump and slides a bit when he stops walkingn hoiw do i stop this?!

  • @user-tx6rq2uz8y
    @user-tx6rq2uz8y Год назад +1

    what button is jump for some reason space is not working for me

  • @thomasleonard9009
    @thomasleonard9009 Год назад +3

    Worked amazingly well for the most part, I just cannot jump. It would be very helpful if you could explain why or if the is a specific key. Thanks! Great tutorial :)

    • @BloxyDev
      @BloxyDev  Год назад

      Did you remember to set a ground layer?

    • @xotixvr3705
      @xotixvr3705 Год назад

      @@BloxyDev i did still dosent work

    • @messyvr1875
      @messyvr1875 Год назад +1

      @@xotixvr3705 i just figured it out and you need your ground to be set to default and the new layer you add( ground) hope this helped

    • @xlenzyl7604
      @xlenzyl7604 Год назад

      @@messyvr1875 im confused can you explain better what do you mean your ground to be set to default and the new layer you add( ground) i didn't understand i would be lots of help you could explain

    • @canadiandonuts12
      @canadiandonuts12 Год назад

      Nothing happened

  • @mr.4o513
    @mr.4o513 7 месяцев назад

    Thank you so much

  • @jaylindowney9757
    @jaylindowney9757 26 дней назад

    bro you are the best you are the only one that works

  • @coolgamermc2171
    @coolgamermc2171 Год назад +1

    when i drag the movement script, the movement script wont show up

  • @skebleton
    @skebleton 7 месяцев назад

    I can only turn my camera on a x-axis/horizontal direction, any fixes?

  • @piecehacking7090
    @piecehacking7090 10 месяцев назад

    Why are you not famous?
    edit: Thx bro it worked

  • @adisendo6069
    @adisendo6069 Год назад

    U are god. Finally someone with working script + i can turn off the smooth time

  • @StupidJellyfish
    @StupidJellyfish 4 месяца назад

    When I put this in, the camera turns completely to the right when I press play. I cannot figure out why.

  • @tankssmusic
    @tankssmusic 11 месяцев назад

    i added a grapple gun and when i shift it messes it up so how do i turn shift off?

  • @thenonhuman9593
    @thenonhuman9593 Год назад

    I tried 5 tutorials on how to do this and even this one Didnt work do you know why and can u help me ?

  • @baz_7
    @baz_7 2 месяца назад

    Thanks ❤

  • @g0uzi
    @g0uzi Год назад +1

    Thanks

  • @PrinceVegetable
    @PrinceVegetable Год назад

    Where do I write the code, I can’t open the script Bcus it asks to open notepad or unity editor

  • @privatekamal3247
    @privatekamal3247 11 месяцев назад

    your a LEGEND

  • @lettuce1355
    @lettuce1355 11 месяцев назад

    Quick question, how can i add sprint?

  • @good_noodlewastaken
    @good_noodlewastaken Год назад +1

    my jump doesnt work for some reason

  • @honeybunbandit568
    @honeybunbandit568 Год назад

    The camera works but i cant actually move am i missing something?

  • @nootnot4548
    @nootnot4548 2 месяца назад

    help noob here . I already removed the errors but it seems there is no collision in my ground I always fall whenver I run

  • @akirayo4168
    @akirayo4168 11 месяцев назад

    I got the serializeField issue, what should i do?

  • @asriel_dreemur_fan
    @asriel_dreemur_fan Год назад

    I keep teleporting through the ground when i got near some of the cubes i placed

  • @SonicMonke
    @SonicMonke Год назад

    do u need the eye??

  • @Many.manmenwithotherman
    @Many.manmenwithotherman 9 месяцев назад

    All of the tutorials on 1st person movement have not worked and this dont work pls help

  • @user-ck6zm9eh9v
    @user-ck6zm9eh9v 10 месяцев назад

    nice video

  • @medic_male07
    @medic_male07 Год назад

    the link its not functioning, and im new, so i'll need to pause and copy the script?

  • @alifsandi8152
    @alifsandi8152 5 месяцев назад

    i have problem with the jump. if you press the jump button many times it will jumping for eternity. di someone know how to fix this?

  • @IndeGames81
    @IndeGames81 Год назад

    thax thes video shude more populer

  • @Buford4
    @Buford4 Год назад

    error CS0103: The name 'Nameof' does not exist in the current context

  • @user-mi6wf1fj3m
    @user-mi6wf1fj3m 6 месяцев назад

    I think this idea would work great, if the variables would run. "The variable playerCamera of Movement has not been assigned.

  • @draconicstudios368
    @draconicstudios368 7 месяцев назад

    Will you ever make a sprinting tutorial using this script?

  • @skythedark11
    @skythedark11 Год назад

    my guy falls over for every movment

  • @AtlasAnimationXzX
    @AtlasAnimationXzX 10 месяцев назад

    What are the dots in lines 47-end

  • @Inky_puppets
    @Inky_puppets 3 месяца назад

    can you make a tutorial for a wall jump

  • @mello76_fri43
    @mello76_fri43 Год назад

    When i jump my camera just falls through the ground

  • @slowness6818
    @slowness6818 Год назад +1

    Hello can sombady help me. You have open script menu where did you doing jump height ando more. And I cant open it can sombady help please.

    • @BloxyDev
      @BloxyDev  Год назад +1

      You need to put the script in the player for it to work.

  • @TOXIC_DIBRA
    @TOXIC_DIBRA 3 месяца назад

    Broo when I put the script in to my capsule the script doesn't do anything man it's just a name o f the script that's all I cant do anything with this I can't move pls someone help❤❤

  • @DumClothing
    @DumClothing Год назад

    I feel stupid. I'm just trying to make my first game and it doesn't give me the options for jump height or speed or any of that stuff, if anyone else got this problem or they know what's happening pls help me.

  • @Phee_VR
    @Phee_VR 11 месяцев назад

    is there a link i can use for the script?

  • @adude200
    @adude200 11 месяцев назад

    hippity hoppity your code is now my property

  • @mksmm1709
    @mksmm1709 Год назад

    jump dont work i add ground to ground layer and to script and still

  • @BloxyDev
    @BloxyDev  Год назад +3

    Hope you enjoyed!

  • @ParpleYt
    @ParpleYt 6 месяцев назад

    What are the movement controls

  • @LegoYodaVr
    @LegoYodaVr Год назад

    mine says it dose not work any suggestions

  • @BLACKDREAMIO
    @BLACKDREAMIO Год назад

    YOIUR MASTERPICE

  • @danielleboston1066
    @danielleboston1066 Год назад +1

    hello im new to making games so i watched video and goin to be honested coppyed code and for me it not showin all the mouse sens and other stuff is it what i do is it cause code or do i need to save and exit it lol i dont know

  • @user-hh4pz1ty8k
    @user-hh4pz1ty8k 11 месяцев назад +1

    best movment script video ever

  • @sdsdfdu4437
    @sdsdfdu4437 Год назад

    You didn't make a character controller you just used the one provided by default

  • @Kilisei
    @Kilisei Год назад

    Hello what whould be an easy way to make a sprint button ? :D

    • @drakefire98
      @drakefire98 11 месяцев назад

      here is the fixed code with sprinting implemented using the shift key
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class Movement : MonoBehaviour
      {
      [SerializeField] Transform playerCamera;
      [SerializeField] [Range(0.0f, 0.5f)] float mouseSmoothTime = 0.03f;
      [SerializeField] bool cursorLock = true;
      [SerializeField] float mouseSensitivity = 3.5f;
      [SerializeField] float Speed = 6.0f;
      [SerializeField] [Range(0.0f, 0.5f)] float moveSmoothTime = 0.3f;
      [SerializeField] float gravity = -30f;
      [SerializeField] Transform groundCheck;
      [SerializeField] LayerMask ground;
      public float jumpHeight = 6f;
      float velocityY;
      bool isGrounded;
      float cameraCap;
      Vector2 currentMouseDelta;
      Vector2 currentMouseDeltaVelocity;
      CharacterController controller;
      Vector2 currentDir;
      Vector2 currentDirVelocity;
      Vector3 velocity;
      void Start()
      {
      controller = GetComponent();
      if (cursorLock)
      {
      Cursor.lockState = CursorLockMode.Locked;
      Cursor.visible = true;
      }
      }
      void Update()
      {
      UpdateMouse();
      UpdateMove();
      }
      void UpdateMouse()
      {
      Vector2 targetMouseDelta = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
      currentMouseDelta = Vector2.SmoothDamp(currentMouseDelta, targetMouseDelta, ref currentMouseDeltaVelocity, mouseSmoothTime);
      cameraCap -= currentMouseDelta.y * mouseSensitivity;
      cameraCap = Mathf.Clamp(cameraCap, -90.0f, 90.0f);
      playerCamera.localEulerAngles = Vector3.right * cameraCap;
      transform.Rotate(Vector3.up * currentMouseDelta.x * mouseSensitivity);
      }
      void UpdateMove()
      {
      isGrounded = Physics.CheckSphere(groundCheck.position, 0.2f, ground);
      Vector2 targetDir = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
      targetDir.Normalize();
      // Check if sprinting
      float currentSpeed = Input.GetKey(KeyCode.LeftShift) ? Speed * 2f : Speed;
      currentDir = Vector2.SmoothDamp(currentDir, targetDir, ref currentDirVelocity, moveSmoothTime);
      velocityY += gravity * 2f * Time.deltaTime;
      Vector3 velocity = (transform.forward * currentDir.y + transform.right * currentDir.x) * currentSpeed + Vector3.up * velocityY;
      controller.Move(velocity * Time.deltaTime);
      if (isGrounded && Input.GetButtonDown("Jump"))
      {
      velocityY = Mathf.Sqrt(jumpHeight * -2f * gravity);
      }
      if (isGrounded && controller.velocity.y < -1f)
      {
      velocityY = -8f;
      }
      }
      }

  • @_Pollard_
    @_Pollard_ 10 месяцев назад

    ty so much for this. because im making a backrooms game

  • @axelvdh6131
    @axelvdh6131 Год назад

    Everything works fine exept i cant run, was it part of the script or did i miss something?

  • @reallyanderson
    @reallyanderson Год назад

    I tried this code, but the [SerializerField] isn’t working. I typed everything out right :/
    It says “The type or namespace name ‘SerializerField” could not be found”

    • @davepolo7407
      @davepolo7407 Год назад +2

      It's [SerializeField] you have added an extra "r".

    • @akirayo4168
      @akirayo4168 11 месяцев назад

      ​@@davepolo7407doesn't work either

  • @doritromod294
    @doritromod294 Год назад

    jumping isnt working for me can somebody help me???

  • @omerkayradelikara9513
    @omerkayradelikara9513 10 месяцев назад

    1:05 tysm

  • @jobraking
    @jobraking 11 месяцев назад

    man pls help jump doesnt work

  • @locodiamind
    @locodiamind 11 месяцев назад

    I need help when i walk it doesn't let me turn how do i fix that.

  • @OrqaV
    @OrqaV 10 месяцев назад

    I scaled down the Capsule and now I dont drop to the ground anymore and cant move around only looking around works
    someone know how to fix?

    • @Zoe-rw6vp
      @Zoe-rw6vp Месяц назад

      i have the same problem

  • @goofysongs1722
    @goofysongs1722 Год назад

    Help as soon as I’m on top of something my jump does not worm

    • @BloxyDev
      @BloxyDev  Год назад

      Make sure to also set those objects layers to GROUND. Hope this helps!

  • @Centicc
    @Centicc Год назад

    the jump isnt working

  • @onur8732
    @onur8732 Год назад

    mine is falling trough map or foalting in space what do i do

    • @Polestelar
      @Polestelar Год назад

      Have you put any collisions in your plane/ map?

  • @Bro-tl8jo
    @Bro-tl8jo 11 месяцев назад +1

    Hey, i have a problem, when I run the game, it makes me fall into the void, can someone please help me, thanks

    • @Tank882
      @Tank882 5 месяцев назад

      Make a platform to stand on

  • @amerhammam1041
    @amerhammam1041 11 месяцев назад +1

    Running and sliding please