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.
Great tutorial. could you show the whole script through out the video?
please make a video on character rotation thats very confusing one
W mans thanks bro
Next episode when
This is amazing tutorial
Sir, may I repost your tutorial on a Chinese platform? UA-cam is not available in China.
sure.
@@Brokencircuitboard Thanks a lot!
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()
at 2:31 you can see how i did the 2 variable method.
@@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
+1 sub
Hi, is there a way you can make a video in AnimationNodeBlendTree thankQ
Bang tutorial ROOT MOTION
Where can i get a model with root bone
Ragdoll??? Or you can't do that
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.
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.
@@3dAISI Your camera flicking issue could be related to springarmd3d coliision mask.
my guy doesn't move.
same
Same
Did you add root bone to animationtree?
@@Brokencircuitboard it works now
My guy dosent move
never seen such a smooth motion in godot, good job 😋!
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.
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!
thought I would note the model is a .glb, it was originally a .vrm when I imported it into blender
update: figured it out! I needed to add a root bone to the mixamo armature before retargeting the animation to my model in blender!
My charactor doesn't move. What can i do?
Which key
@@uavlogsandgaming6748 do your character have root bone?
Just discovered your channel, I love your content!
where can I get a model of this character?
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
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.
@@Brokencircuitboard next update like which version are you waiting so that I dont need to break my head in fixing this problem LoL😅😅🤕
@@CopyCatBlack Unfortunately, i don't ever set any timeline for my update😅
@@Brokencircuitboard ohhh:(
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
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.
great tutorial thank you so much
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
Never done NPC before. But wasn't it easier with script though?
@@Brokencircuitboard idk I haven't implemented this yet, I'm still working on animations
@@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.
@@Brokencircuitboard aha I see what you mean, thank you for giving an answer!
First...❤ From India
Divice Android
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?
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?
@@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.
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()
@@TheSkatingAces Yup. that's about right. Now check out part 2 of this tutorial to fixed those input move.
@@Brokencircuitboard still not working. would be easier if i could show screenshots:/ discord?
what is that model you used here?
It from unreal ALS v4. I ported it to godot.
@@Brokencircuitboard thank you very much ❤
why I'm getting this type of error?
root_velocity = current_rotation * root_pos / delta
Unexpected "Identifier" in class body.
you need to declare root_velocity first.
We need more videos similar to this
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"
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.
Pls a car tutorial pls
where did you get that model i really want to know
omg thank you animation state machines were so confusing to me!
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?
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.
I found a mixamo add on in blender, some people have tutorials up for adding the root, there is a specific one for godot
Amazing, I've a question, can we blend the walk animation with the player's speed?
Yes we can. We can add RUN cycle when pressing sprint or use blendspace.
@@BrokencircuitboardOoo okay thanks
Cool, can u add Rotation Motion 😮
Working on it. Expect it to be available in a few days.
@@Brokencircuitboard Sorry I'm confused, I thought this was root motion?
@@phoenixastra4429 It is. I just not making player turn in this tutorial. Your project files should contain all completed project.
@@Brokencircuitboard Ohh okay! Sorry the other guys comment confused me I wanted to make sure I understood xD tysm!
Would this work on unity?
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.
@@Brokencircuitboard alr thanks man
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
is there anyway to get the source code for free cause im broke af
Don't worry, more tutorial are coming. I'll share the code on my tutorial.
@@Brokencircuitboard allright thank youu
Just a little question but will you do tutorials on animation? I'm not a good animator and I'm terrible at 3d stuff
Same. i use pre make animation instead of animate it myself. Mixamo is your friend.