GODOT 4 ROOT MOTION MOVEMENT TUTORIAL

Поділитися
Вставка
  • Опубліковано 28 вер 2024
  • Unfortunately i cannot cover the whole tutorial in this video. I'll add third person camera and player rotation in the next video.
    Part 02 : • Godot 4 Third Person C...
    You can test the compile project at www.mediafire....
    As for source code, you can get it at my patreon page:
    / brok3ncircuitproject
    Full project also include turn 180 movement.

КОМЕНТАРІ • 88

  • @matthewirizarry1425
    @matthewirizarry1425 4 місяці тому +3

    Great tutorial. could you show the whole script through out the video?

  • @tayorain6554
    @tayorain6554 Місяць тому

    please make a video on character rotation thats very confusing one

  • @UnityScrapesfordimes
    @UnityScrapesfordimes 5 місяців тому +1

    W mans thanks bro

  • @plothasholes4462
    @plothasholes4462 5 місяців тому +1

    Next episode when
    This is amazing tutorial

  • @XiaoLinCn
    @XiaoLinCn 4 місяці тому

    Sir, may I repost your tutorial on a Chinese platform? UA-cam is not available in China.

  • @CopyCatBlack
    @CopyCatBlack 20 днів тому

    In 8.33 video I tried it and it was not working my code was alittle similar.
    I did it in other way, I had to make 4 different conditions like Idle, Idle2, Motion and Motion2.
    The Idle2 and Motion2, I had to put a different conditions on start walk and stop walk and it is now working but I am not satisfied with this code.
    I would prefer your code the best becuz it only requires 2 condition
    Only if I know what wrong have I done in my code that is not working.
    Btw here is my script.
    I have set the direction as my input button like w,s,a,d
    if direction:
    anim.set(parameters.....Motion, true)
    anim.set(parameters.....Motion2, true)
    anim.set(parameters.....Idle, false)
    anim.set(parameters.....Idle2, false)
    Else:
    anim.set(parameters.....Idle, true)
    anim.set(parameters.....Idle2, true)
    anim.set(parameters.....Motion, false)
    anim.set(parameters.....Motio2, false)
    Velocity = transform.basis * anim.get_root_position() * 100
    Move and slide()

    • @Brokencircuitboard
      @Brokencircuitboard  20 днів тому +1

      at 2:31 you can see how i did the 2 variable method.

    • @CopyCatBlack
      @CopyCatBlack 18 днів тому

      @@Brokencircuitboard yeahhh that worked i had to remove the anim.set(parameters...idle and motion, is_moving) in the direction and just simply out it this way
      Var is_moving = bool()
      If direction != vector3.zero:
      Is_moving = true
      Else:
      Is _moving = false
      And that fixed my problem
      ThankQ soooo much sir

  • @I-Support-Ukraini
    @I-Support-Ukraini 5 місяців тому +2

    +1 sub

  • @CopyCatBlack
    @CopyCatBlack Місяць тому +1

    Hi, is there a way you can make a video in AnimationNodeBlendTree thankQ

  • @gedesujaya6678
    @gedesujaya6678 Місяць тому

    Bang tutorial ROOT MOTION

  • @AmanMusthafa007
    @AmanMusthafa007 Місяць тому

    Where can i get a model with root bone

  • @Freee277
    @Freee277 2 місяці тому

    Ragdoll??? Or you can't do that

  • @3dAISI
    @3dAISI Місяць тому

    Cool TUT, thx. I hage also problem with velocity now, always 0. Evetything else is OK. .... ahh no no :) I have also some camera flicking issue. I thing I fix that in the past. Something with ArmSpring3D.I will work on that today. Have a nice day.
    ..... after while .... I forgot my char has in placement move LOL. Anyway some problems with my camera flick from time to time.

    • @3dAISI
      @3dAISI Місяць тому

      Add the "Add Leaf Bones" are no needed when you exporting Im guessing. Would be nice to have easy tut with fck'ing root bone in model thru the native blender.

    • @Brokencircuitboard
      @Brokencircuitboard  Місяць тому

      @@3dAISI Your camera flicking issue could be related to springarmd3d coliision mask.

  • @SunJaycy
    @SunJaycy 3 місяці тому +5

    my guy doesn't move.

  • @baoinh2968
    @baoinh2968 18 днів тому +1

    never seen such a smooth motion in godot, good job 😋!

  • @UnityScrapesfordimes
    @UnityScrapesfordimes 5 місяців тому +1

    Can you add to this a turn system similar to red dead two, it’s when you lightly tap the joystick or wasd and it rotates the way the wasd or joystick is facing, it’s also in gta 5. Btw what animations did you use, can you link them when I tried this in until it kept moving me to the side.

  • @skulltrick
    @skulltrick 2 місяці тому

    My player doesn't move :( I have a rootbone for my skeleton but I guess it is incompatible somehow? I'm using a .vrm that I rigged in Blender and added retargeted mixamo animations to. Do you think I should look for a different method rather than root motion?
    Regardless, thanks for the video it was still very informative!

    • @skulltrick
      @skulltrick 2 місяці тому

      thought I would note the model is a .glb, it was originally a .vrm when I imported it into blender

    • @skulltrick
      @skulltrick 2 місяці тому

      update: figured it out! I needed to add a root bone to the mixamo armature before retargeting the animation to my model in blender!

  • @uavlogsandgaming6748
    @uavlogsandgaming6748 3 місяці тому +1

    My charactor doesn't move. What can i do?

  • @mohandamokraneabdiche1051
    @mohandamokraneabdiche1051 5 місяців тому +2

    Just discovered your channel, I love your content!

  • @shad0wborn602
    @shad0wborn602 5 місяців тому +1

    where can I get a model of this character?

  • @CopyCatBlack
    @CopyCatBlack Місяць тому

    Hi again,
    Can you also make a video on the strafing animation, I tried to do that but it is not working properly whenever I assign my root bone to the rootmotion my character stops rotating, do you have a discord or something that I can share the video. ThankQ

    • @Brokencircuitboard
      @Brokencircuitboard  Місяць тому +1

      Strafing is something i plan to do on next update. I think it's better to use script driven movement for strafing, unless you plan for realistic movement.

    • @CopyCatBlack
      @CopyCatBlack Місяць тому

      @@Brokencircuitboard next update like which version are you waiting so that I dont need to break my head in fixing this problem LoL😅😅🤕

    • @Brokencircuitboard
      @Brokencircuitboard  Місяць тому +1

      @@CopyCatBlack Unfortunately, i don't ever set any timeline for my update😅

    • @CopyCatBlack
      @CopyCatBlack Місяць тому

      @@Brokencircuitboard ohhh:(

  • @nocco0759
    @nocco0759 5 місяців тому +1

    Great Tutorial, thanks for sharing this man, also i have a question if you don't mind, when you import a character from mixamo with animation to godot, then you let's say you want to add new animation to the character from blender, how can you add new animation to the character using AnimationPlayer ?, i tried to add new animation but i couldn't find where to link it to the character model. Thanks in advance

    • @Brokencircuitboard
      @Brokencircuitboard  5 місяців тому +2

      First, retarget the animation bone to match godot humanoid skeleton. Then, inherit that animation scene. Open the animationplayer that came with the animation. At animation track, open 'Manage Animations', 'Make Unique' then save the animation. You can upload the save animation for other character later.

  • @fake_sunner
    @fake_sunner 5 місяців тому +2

    great tutorial thank you so much

  • @Matthew_Fog
    @Matthew_Fog 29 днів тому

    Quick question: Could you make a video showing an NPC using root motion?
    I'm trying to figure out if my animations should be root motion or not for my NPCs

    • @Brokencircuitboard
      @Brokencircuitboard  29 днів тому

      Never done NPC before. But wasn't it easier with script though?

    • @Matthew_Fog
      @Matthew_Fog 29 днів тому

      @@Brokencircuitboard idk I haven't implemented this yet, I'm still working on animations

    • @Brokencircuitboard
      @Brokencircuitboard  29 днів тому +1

      @@Matthew_Fog From my understand of basic npc logic. We just move a capsule(NPC) to player(Another capsule) or checkpoint. It simpler with script, since we can just program npc to play walking animation when it move and play idle when not moving or play attack logic when close to player. Since root motion depend on actual npc movement, the logic become more complex because now we need to program the movement and rotation input of the npc to make it move to it target. Don't quote me on this, i might be wrong here and there is a simpler method to do it, but for npc, i rather use script for now.

    • @Matthew_Fog
      @Matthew_Fog 29 днів тому

      @@Brokencircuitboard aha I see what you mean, thank you for giving an answer!

  • @F.B.J-50
    @F.B.J-50 5 місяців тому +1

    First...❤ From India
    Divice Android

  • @TheSkatingAces
    @TheSkatingAces 3 місяці тому

    Hey! my character can move around but the animations do not play, the character just stays static. The rootbone is selected in the animationtree but it does not work?

    • @Brokencircuitboard
      @Brokencircuitboard  3 місяці тому

      It seem you are moving your character through code. If you follow my script, your character should not moving if the animation not playing since it done entirely by root bone. Either the code is missing something or your character's root bone is not actually root bone. Do you perhaps use mixamo animation?

    • @TheSkatingAces
      @TheSkatingAces 3 місяці тому

      @@Brokencircuitboard Hey, thanks for the reply. Yeah i use mixamo animation, but i have used a mixamo rootbone plugin in blender to give it one. I have now managed to get the animations to play, but all the key inputs move the character forward, even though i have assigned them in the input map.

    • @TheSkatingAces
      @TheSkatingAces 3 місяці тому

      Here's my script. I think i did it as you did in the video? Maybe i missed something.
      extends CharacterBody3D
      #Animation Parameter
      @export var animation_tree : AnimationTree
      @export var animation_player : AnimationPlayer
      @onready var animation_state = animation_tree.get("parameters/playback")
      # player parameter
      var inputdir = Vector3()
      # animation Condition States
      var anim_canmove = bool()
      # Physics values
      var direction = Vector3()
      var vertical_velocity = Vector3()
      var turn_speed = 10
      var root_velocity = Vector3()
      #input
      var horizontal = float()
      var vertical = float()
      func _process(delta):
      horizontal = Input.get_axis("right", "left")
      vertical = Input.get_axis("backward", "forward")

      var root_pos = animation_tree.get_root_motion_position()
      var current_rotation = (animation_tree.get_root_motion_rotation_accumulator().inverse() * get_quaternion())
      root_velocity = current_rotation * root_pos / delta
      var root_rotation = animation_tree.get_root_motion_rotation()
      set_quaternion(get_quaternion() * root_rotation)


      func _physics_process(delta):
      animation_tree.set("parameters/conditions/startmove", anim_canmove)
      animation_tree.set("parameters/conditions/idle", !anim_canmove)

      #Movement input
      inputdir = Vector3(horizontal,0, vertical).normalized()

      if (inputdir != Vector3.ZERO):
      anim_canmove = true
      else:
      anim_canmove = false


      velocity = root_velocity
      move_and_slide()

    • @Brokencircuitboard
      @Brokencircuitboard  3 місяці тому

      @@TheSkatingAces Yup. that's about right. Now check out part 2 of this tutorial to fixed those input move.

    • @TheSkatingAces
      @TheSkatingAces 3 місяці тому

      @@Brokencircuitboard still not working. would be easier if i could show screenshots:/ discord?

  • @apricoskaart9147
    @apricoskaart9147 5 місяців тому +1

    what is that model you used here?

  • @zaccmain3121
    @zaccmain3121 3 місяці тому

    why I'm getting this type of error?
    root_velocity = current_rotation * root_pos / delta
    Unexpected "Identifier" in class body.

  • @bobcats-w3p
    @bobcats-w3p 24 дні тому

    We need more videos similar to this

  • @christopherfrancisco8966
    @christopherfrancisco8966 3 місяці тому

    Love your tutorials. Will any 3d model work? (i.e: one downloaded from Mixamo), or is there a requirement the 3d model must meet in order for root movement to work? (I know you said about to "root" bone, but is that a convention of some sort? My model has a single bone as the parent but it isn't called "root"

    • @Brokencircuitboard
      @Brokencircuitboard  3 місяці тому

      Yes. Your character model must have root bone to work with this script. Mixamo animation don't have root bone by default, but there are blender plugins to add it or you can do it manually. U can also use hip bone as replacement to root motion, but it will not look right.

  • @_TechInsightHub
    @_TechInsightHub 5 місяців тому

    Pls a car tutorial pls

  • @christiancampbell1774
    @christiancampbell1774 4 місяці тому

    where did you get that model i really want to know

  • @phoenixastra4429
    @phoenixastra4429 4 місяці тому

    omg thank you animation state machines were so confusing to me!

  • @mudinlange
    @mudinlange 4 місяці тому

    excellent tutorial!
    how did you set your "root" bone?
    I was trying to use the mixamo "Hips" bone as the root, but it turns animations extremely janky
    I mean, I belive you attached a new bone "root" in blender, but how do you pair it with the move animations?

    • @Brokencircuitboard
      @Brokencircuitboard  4 місяці тому +1

      I did it manually with blender. The new root bone bone must be the parent of all the bone in the hierarchy. There are plugins out there you can try.

    • @phoenixastra4429
      @phoenixastra4429 4 місяці тому

      I found a mixamo add on in blender, some people have tutorials up for adding the root, there is a specific one for godot

  • @unfunnyman76
    @unfunnyman76 4 місяці тому

    Amazing, I've a question, can we blend the walk animation with the player's speed?

    • @Brokencircuitboard
      @Brokencircuitboard  4 місяці тому

      Yes we can. We can add RUN cycle when pressing sprint or use blendspace.

    • @unfunnyman76
      @unfunnyman76 4 місяці тому

      ​@@BrokencircuitboardOoo okay thanks

  • @Sashye111
    @Sashye111 5 місяців тому +3

    Cool, can u add Rotation Motion 😮

    • @Brokencircuitboard
      @Brokencircuitboard  5 місяців тому +6

      Working on it. Expect it to be available in a few days.

    • @phoenixastra4429
      @phoenixastra4429 3 місяці тому

      @@Brokencircuitboard Sorry I'm confused, I thought this was root motion?

    • @Brokencircuitboard
      @Brokencircuitboard  3 місяці тому +1

      @@phoenixastra4429 It is. I just not making player turn in this tutorial. Your project files should contain all completed project.

    • @phoenixastra4429
      @phoenixastra4429 3 місяці тому

      @@Brokencircuitboard Ohh okay! Sorry the other guys comment confused me I wanted to make sure I understood xD tysm!

  • @UnityScrapesfordimes
    @UnityScrapesfordimes 5 місяців тому +1

    Would this work on unity?

    • @Brokencircuitboard
      @Brokencircuitboard  5 місяців тому

      Yes it will. In fact, it will be even simpler since unity come with build in root motion and unity animator IMHO is way better than godot.

    • @UnityScrapesfordimes
      @UnityScrapesfordimes 5 місяців тому

      @@Brokencircuitboard alr thanks man

  • @StartGameDev
    @StartGameDev 5 місяців тому +1

    Hi, I am a Silver subscriber on your patrion, I would like to ask you to make videos showing how to do the Silver systems, and make them available only to those who are Silver, as I have difficulty learning by looking

  • @bnkm07
    @bnkm07 5 місяців тому +1

    is there anyway to get the source code for free cause im broke af

    • @Brokencircuitboard
      @Brokencircuitboard  5 місяців тому

      Don't worry, more tutorial are coming. I'll share the code on my tutorial.

    • @bnkm07
      @bnkm07 5 місяців тому

      @@Brokencircuitboard allright thank youu

  • @ItsSualConnected
    @ItsSualConnected 5 місяців тому

    Just a little question but will you do tutorials on animation? I'm not a good animator and I'm terrible at 3d stuff

    • @Brokencircuitboard
      @Brokencircuitboard  5 місяців тому

      Same. i use pre make animation instead of animate it myself. Mixamo is your friend.