Creating a 3D Character Controller With Animations with Godot 4!

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

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

  • @kabaoum1519
    @kabaoum1519 Год назад +21

    This tutorial was exactly what I needed to understand how the animation tree conditions worked! It just wasn't clear to me that adding a condition to a transition resulted in a new property on the animation tree node. I really appreciated the starter project so I could get right to the details of the tutorial.
    Some critiques on the video
    1) You could remove the manual "lookAt" code that makes the camera point at the head of the character if you set the controller (and by extension the spring arm's origin) to the same global position as the "lookAt" node in the controller's code - then the camera will naturally point at the place that you want without making manual adjustments to the camera's rotation
    2) the state machine could be drastically simplified if you inserted a 2d blendspace for the walk/strafe animations instead of inserting all of the animations directly, then the walking logic can be handled by a single set of transitions and the animations will blend seamlessly between walk and strafe

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

      Hey thanks for watching also, thank you for the critiques! I actually do number 2 in my root motion tutorial I didnt think about using it until my c# version of this tutorial! As for 1 ill have to look at it.. I think I do something similar to this on my root motion tutorial as well but I don't remember..

  • @The_Soup_Wizard
    @The_Soup_Wizard Год назад +18

    Nomination for best upcoming Godot RUclipsr.

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

      Nah heartbeast is way better!

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

      @@FinePointCGI I don't know I have watched him also and yes he is good but I think you have them all beat.

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

      ​@@FinePointCGI hell naw

  • @remigodin9103
    @remigodin9103 Год назад +10

    Right on time! Started playing around with animations yesterday and this video really helps! I appreciate your hard work!

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

      Hey thanks I hope it out was useful!

  • @mrkaratedo
    @mrkaratedo Год назад +5

    Excellent tutorial in third person, very good!. I hope you continue another one: where the character executes actions by touching objects, for example, climbing on a box

  • @Turgoleh
    @Turgoleh Год назад +6

    About the rotations, in code they're expressed in radians. So @11:44, -1 actually means 60° (PI/3) and is above the character, while 0.25 corresponds to 14° close to the ground.

  • @sega5785
    @sega5785 Год назад +32

    You should include delta time in lerp statement. If framerate changes the bahavior of rotation will be unexpected.

    • @FinePointCGI
      @FinePointCGI  Год назад +13

      This makes sense! I have noticed some odditys here and there so that's probably why!

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

      How can I do that?

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

    lol perfect timing!! literally searched for this a half hour after it came out.

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

    رحم الله والديك حبي والله لو ما انتة چان هسة شامر هالسالفة التعبتني وراية....thanks alot❤️

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

    I'm an absolute beginner so I really appreciate this! I was trying to learn another character controller one and then add my own stuff to it (bc I want to try to do stuff on my own at least for practice in between tutorials? So I'm not just doing tutorials I guess to begin xD but someone was coding the movement manually instead of using state machines and state machines is SO much easier holy heck. The jump and fall was driving me crazy because of an locked/unlocked animation situation. So greatful for this

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

    best explanation for State Machine and Animation Tree so far that i found !

  • @user-rx3xl7zn1u
    @user-rx3xl7zn1u Год назад +4

    Thank you for this. I painstakingly went through the animations to fix the weird fall landing issue.

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

      Yeah it's a bad animation on my part to use but mixamo animations can be funky

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

      @@FinePointCGI I've only just begun learning Godot and figured it was a chance to learn Godot a bit more.

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

    For all newcomers like me:
    40:30 I think a clean solution is a blendspace 2d node for all walking, strafing and idle animations. I use blendspace 1d for my character because I don't need strafing and it works very well. And maybe we can put the jumping/falling stuff in a seperate state machine node, but I didn't try it myself.
    Thanks for this tutorial, it helped me a lot!

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

    Just found this channel, and this is amazing timing as I am new to Godot and with the new version out there this is very convenient. Keep it up!

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

      Hey Welcome! I hope I can help you out! Let me know if there's any topics you think would be good to be covered and ill be more then happy to look into it.

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

    if you are having problems with the lerp section, what i did is I changed .05 to 4.2 * delta and also I put the position of the LookAt node in camera controller to -400. I dont know if this is good practice or a good solution but it works much better than before. I also have the y position of the LookAt node in camera controller to 2(around the same height as my characters head)

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

      That does seem like a good solution when i did that i ran into issues with jumping and my character would learp slow although you should multiply by delta which is something i missed

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

    This is just what I wanted. I can't wait to watch this later!

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

    Thank you for sharing your Godot 4 game engine online tutorial it has been a big help for me to get started on my indie Game development journey with Godot 4. Please keep up the good work doing the online tutorial.

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

    I would love if you could do a video of how to set it up the character in blender and if you could add in a way to go from first person to third person view.
    really great video though i am learning a lot from your channel so thank you so much.

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

    This was brilliant, thank you!. I finally understand how to use and setup my own state machine controllers!

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

    the lerp lazy rotation part was a life saver

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

    More videos about the Godot engine,it was really useful,I am beginner at this stuff, I wish you luck with your videos

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

    Not sure if you're aware but you can use blend space 2D to make your state machine much much less messy

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

      I do this in my root motion tutorial it's definitely something I learned after the fact!

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

    Use animation tree blender space!!

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

    It would also be good if you make him move crouched. Thanks and great job!

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

    Hi
    Thanks for the video
    I know this is very basics
    I didn't know how to do this 😅

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

    Instead of running LookAt every frames, it is better to set the spring arm global location to the Node3D target in the Player Scene during _Ready() to get the same result with less runtime calculation

  • @Tarnest
    @Tarnest Год назад +5

    Are you able to describe your learning process, basically how you learned how to make things in Godot? I’m trying to figure out how I should approach things since of course this stuff is very difficult.
    My idea as of right now is to continue following tutorials until I have some understanding of what tools I have to use and try to create little mini games with them. I’m not sure how effective this method is, and it’s certainly hard to keep myself motivated with the frustration of not knowing anything.
    Either way, I’m curious as to your approach and I would like to see if I could apply your methods to my own.

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

      Tell me when he replies 😅😅

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

      My approach is to just keep trying new things. What really helped was breaking down my problems into smaller sections and then researching those small sections.
      Coding things in a very reusable way is something that comes with time so you're going to have hundreds of projects that are not well put together.
      Most of my projects today are still not well put together lol

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

    Very good Tutorial. Thank You!

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

    Everything in the tutorial seemed to work great. Up until the lerp section. Not sure if I did something wrong. But now the player only wants to look at center of map. Before adding the lerp code the player followed the camera properly.

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

    jesus that animation state machine is crazy. I could image it being really useful for smaller things but anything with interlinking transitions is just crazy. Would be unmanageable if you added more.

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

      I'm told there is sub statemachines so I'm going to look at them and see if that helps!

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

      @@FinePointCGI ow that would be awesome and make more sense. Great video as always by the way :-)

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

    Wow. That animation tree is a spider-web.

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

      In the c# version I do it quite a bit better using blendtrees but yes in this one it's a web..

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

    Nice video! I personally prefer putting the camera under the player scene using a pivot + spring arm (as you did) and putting the mesh / collisionshape under a node within the player tree so turning the character(mesh/shape) doesn't rotate te camera.
    I would love to see you do a tutorial on your view on using concurrent state machines for things like attacking while jumping, running etc!
    Oh and a fun thing that instantly adds a little more immersion is to put the LookAt (or the pivot point of the spring arm) a little in front of the character's face! It will give you more feedback when turning your character (A little trick from deconstructing Kingdom Hearts' character controller)

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

    This is amazing tutorial thank you.

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

    You can also use an @export var character : CharacterBody3d in the camera script then just select your character

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

    Awesome tutorial!

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

    Hi mr finepointCGI, can you make tutorial how to create fighting game like Mortal kombat??

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

    Great video! Could you make this kind of 3D tutorials with C# or make a C# version, C# is really better when you make a 3D game on Mobile platform, thanks!

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

      I am currently editing this video for C#. Every video I do I try to do a C# version.
      That being said Godot 4 C# does not support mobile yet so id keep that in mind.

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

    This is good stuff. Thanks

  • @rsk-smiles
    @rsk-smiles Год назад

    @FinePointCGI To avoid the animation spaghetti I added separate straifright and lefts to the idle …. I don’t think the tree stops you from having an animation state more than once, so idle can go to its own set of strain right left falling etc… kind of a mirror of the walk and it’s straif left right and falling. Am I being clear?
    great video btw… I am new to Godot and finding your videos have helped me a lot.

  • @4mb127
    @4mb127 Год назад

    Thanks for doing what you do. I really enjoy your videos even though I don't always have time to watch all of them.

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

    I am pretty sure just using a blend tree greatly simplifies the issues you were having with the AnimationTree

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

      Your probably correct however I ran into issues with having it properly transition state. I'm sure I'm missing something but that's why I didn't use it

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

      I can’t really help you there but I know Devmar has done a lot of work with them in Godot 4 and you might be able to glean something from his videos or reaching out to him

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

      You're right it's easier because you can put 5 animations in it (walk at (0, 1) and (0, -1), idle at (0,0), straifleft at (-1,0) and straifright at (1,0)
      and set the blend position with input_dir in the script :
      $AnimationTree.set("parameters/Walk/blend_position", input_dir)

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

      It definitely is! I'm doing the root motion tutorial right now and I have converted to this method using a state machine and a blend 2D.

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

    Could you do short video how to combine different animation from mixamo into one file using blender.

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

      Sure! I'll make a quick one on that today or tomorrow!

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

    I don't know but I feel like the animation tree state machine is a lot harder to use than the 3.x

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

      It kind of is they want to make more adjustments but it didn't get in on time I'm told..

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

    Has anybody else noticed that when the character strafes he moves forward slightly?
    How do I make this work so that my character will strafe perfectly left and right?
    Is it a problem with radians vs. degrees?

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

    If i have chosen a mixamo animation that moves the character forward when doing the walking animation how would I prevent that?

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

      this tutorial is amazing and everything works properly besides the animation moving the character away from the camera

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

      Ended up having to go in the animations in blender and setting the Z Location variables to 0,0

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

      when choosing a walk animation in maximo you can tick the box that says "In Place" on their website

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

    I should have looked at your more recent ones first lol...but this seems like a good start and learning (I'm switching from Unity back to Godot). Thank you for this!
    @FinePointCGI I still can't get my actual player to turn left/right depending on direction he's moving. I don't know what I'm missing. I copied your code to be sure I didn't have a typo, and I didn't. The mouse rotation does also rotate the player somewhat, but he never "turns" right or left. I don't want to strafe, so I'm not including that part. I have looked and can't find anything on just that one part of "turning with movement direction." I'm sure you're busy but if you could reply with a quick word on how to separate the x to make the player turn right/left I'd be forever grateful.
    Notes:
    19:43 Alt F4 may not work on Mac dep on settings, so Command-Q will get you out of the game preview. Of course that quits it and you can't just refresh after--have to play from scratch. I think before we set up that feature, we should set up ESC to release mouse control? That was a panic moment being locked in game with no "escape" lol (and don't say use PC lol).
    Really had to play with LookAt[Cam] positions (1.5 on Y and -7.5 on Z) and SwingArm (.5 on Y) settings to get Player to not look below floor. The script settings only seemed to limit its view ABOVE the floor, but not below.
    Also 'Character character in CameraController Script wouldn't work...had to change Character to CharacterBody3D - CharacterBody3D character (guessing bc the player script says "Extends CharacterBody3D" at the top?).
    I asked Chatbot for "In Godot 4.1 3d, my camera looks below the floor. how do I limit its tilt" and it gave me Max and Min PITCH. Thoughts on this option? Seems much simpler to put it halfway up the player then use pitch than all the stuff here.
    In 4.1 I cannot change the advance condition...it's showing & sign and won't let me edit it. I can't keep going in your tutorial until I find the cause of that and I cannot even after an hour of searching😕 EDIT: AHAHAAA I had the window squished so I could see RUclips & Godot at the same time...so the actual text window after the & wasn't showing/clickable. WOW. That's an hour of being an idiot I'll never get back lol.

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

    Thank you

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

    how would you do a blendtree of this? i have a first person character controller with some animations mapped to the left and right, as well as forward buttons for view sway and i wanna blend between them as i'm strafing

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

    Все супер, только из-за функции lerp() мой персонаж подергивался во время бега (он иногда поворачивался на 180 градусов вокруг своей оси). Заменил на lerp_angle() и проблема решилась🥳🎉. Спасибо за видео.👍

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

    Thanks for great video.
    I tried to add an attack animation, just saw that attack animation always runs , how can I set attack condition to false after attack finished?
    I tried animationtree, animation_finished signal, for some reason , animation still fires twice.

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

    Thank you so much for this tutorial. But do you know how to assign button inputs to animations?
    I followed the tutorial but I'm not sure how to make my player's animation for attack to play after pressing the "B" button.

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

    i kept getting Parser Error: The identifier "global_position" isn't declared in the current scope. ,
    though i thought i followed everything correctly :/

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

      just realized this is for godot 4 not 3 o_o

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

    Will this tutorial have part 2 with more gdscript actions? 🎤

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

      I plan to add vaulting climbing running sneaking and adjusting the character system to only look at a place when you lock on. I may also add dodging as well

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

      @@FinePointCGI It's good that you'll do part 2 with all that you've said. It will be great when it comes out

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

    In GDScript could you explain how to get on a cube or a table by pressing a button?

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

    You mention pretty early into the video how you were able to collapse the animations into just one in blender - do you have more material explaining that a bit more in depth? I am very comfortable in blender, but have done very little with exporting animations out of there.

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

      I take it back - i found it. Youre great.

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

    Hey i love the fact that this actually manages to work as all other one failed to work on mobile, however i noticed that when i jump my character will do this rocking motion. I looked through the code to see if maybe i mess up somewhere but it seems to be right. a small adjustment i made was to move the LookAt node very far but this can make thing harder for levels i fear later down the line as the character still tilts itself in the air. do you know how i can completely lock the axis of the player to prevent this using your camera set up/script?

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

    so if you were to add a punching animation to this it would turn into a cobweb?

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

    Around 21:00 minutes, adding the look_at() function, when moving the camera up it causes the screen to flicker and spams the error:
    "Up vector and direction between node origin and target are aligned, look_at() failed"
    The error is coming from the CameraController script, at the Camera3D's look_at() function. This only seems to happen when moving the camera above the character's head. Any idea how to fix this?
    I've also tried copy/pasting your code directly and I get the same error. I double checked my node set up as well and everything seems to be the same as yours in the video.

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

      I've also noticed that when lerping the movement, when strafing, it causes the character to move in a forward-diagonal way. I could be mistaken but it looks like the same thing is happening in your video as well near the end. Is this intended? How would one set it up so the player only moves true left or right?
      Edit: Seems like you address this in your C# video by moving the LookAt node farther from the player.

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

      You may need to adjust the limits of your clamp that error usually means your camera is directly vertical above the player and your cameras direction and up vector can't be the same value.

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

      @@FinePointCGI I don't know what I did, but I re-wrote part of the code and it's working fine now. I have no idea what changed or what I did wrong...oh well!

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

      @@Bora42896 I don't know exactly what I did wrong originally. I just re-wrote the code again and it started working. I'm not sure what the problem was.

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

      I'm having the same problem. Already checked the script and still can't see the problem :(

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

    Hey I followed this tutorial and everything worked, but when I test it out, my player model mesh rotates while jumping. Sometimes it will even swing around and clip into the floor. I don't want this, how do I fix it?

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

    when I do line 21 and 22 for the camera controller they both get errors saying unexpected identifier In class body I don't know if its the tempRot or something

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

    Why is there a small double jump during the jump before landing? This is also noticeable on the video, but the author did not say a word about it. I think this is a bug, but I don't understand why this is happening.

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

      I call it out in the video or at least I did in the recording. It's due to the idle fall animation I picked. This will not be an issue if the idle fall was designed to work with the land animation.

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

      @@FinePointCGI I understand. Thanks!

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

    :33:53: I only added walking and idle animations, but when I tried scripting, the code didn't work. Do you have a solution, or is there a way to add animations directly from the player, similar to 2D? I'm new to 3D and finding it challenging.

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

    My man, the camera is always centered in the character. I'd like to put him little to the left, like Gow or RE4. How cai I do this with your code?

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

    im having some issues with the camera. it seems to start spinning very quickly when i try to move the camera like 180 degrees in game.

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

    Hi, thank you for the tutorial.
    I'm trying to make your tutorial work in my sample project, and I'm struggling with the rotation feature:
    model.rotation.y = lerp_angle(model.rotation.y, look_direction.angle(), delta * 12)
    When I add this specific line of code in it, it only works at first when I use the directional keys to move, but as soon as I let go the model snaps back to the default angle. Not only that, but it doesn't update to the angle it was facing before I let go, so it still feels like it only looks like it's rotating, but doesn't actually stay rotated.
    can you help me? I know I'm missing something, but I can't tell if it is just the code, the 3d nodes, or a combination of the two.
    (If it helps this be less confusing, I'm trying to break down the features and isolate just rotating my character as I move it, not rotating the camera with my mouse.)

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

    What a great tutorial thank you! Do we get an "anystate" ability? What if I want to play a death animation from any state but don't want to hook all the connect nodes?

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

      the root statemachine could have a death state.

  • @fruitdudetv
    @fruitdudetv 21 день назад

    anyone found out a way so those animation statemachines won't get so messy?

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

    If I want to make the player look at only when I press aim button. and when I don't press the aim button I want the player to rotate toward where ever the player is pressing the keys.. what should I do?

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

    niceeee

  • @AstaRoggers
    @AstaRoggers 7 дней назад

    hey tutorial really helped me and also learned a lot and added walking backwards animation to my project, but i tried to add sprinting and did everything right when i press shift to sprint it does sprint and i think walking animation interrupts sprinting animation so i can't really do or know what to do if u got any idea how to fix please reply, thank you.

    • @FinePointCGI
      @FinePointCGI  7 дней назад

      @@AstaRoggers So something I cover in the c# version of this is using the blend space 2d and it is a better way to go about this in my humble opinion.

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

    Does godot offers the alternative to do animations without that horrible UI? I mean being able to code that instead of using the interface to connect them

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

    How to import GBL file?
    How did you import your character on the node?

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

      If you export your file as a gltf file it will auto import into godot as long as you put it in the project structure

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

    thx for the tutorial but i have a small issue when ever i jump and walk just as i hit the ground i start walking with landing animation until the landing animation is completed and it goes back to normal ,pls help

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

      this is the code
      extends CharacterBody3D
      var sen = 0.5
      var current_speed = 9
      const walk_speed =6
      const JUMP_VELOCITY = 6
      const running_speed = 10
      @onready var pivot = $cam_origin
      var is_running : bool = false
      var is_attacking : bool = false
      # Get the gravity from the project settings to be synced with RigidBody nodes.
      var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
      func _ready():
      Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
      func _input(event):
      if event is InputEventMouseMotion:
      rotate_y(deg_to_rad(-event.relative.x * sen))
      pivot.rotate_x(deg_to_rad(-event.relative.y * sen))
      pivot.rotation.x = clamp(pivot.rotation.x, deg_to_rad(-90), deg_to_rad(45))
      if event.is_action_pressed("sprint"):
      toggle_sprint()
      if event.is_action_pressed("attack"):
      $AnimationTree.set("parameters/conditions/punch", true && is_on_floor())
      elif event.is_action_released("attack"):
      $AnimationTree.set("parameters/conditions/punch", false && is_on_floor())

      func _physics_process(delta):
      # Add the gravity.
      if not is_on_floor():
      velocity.y -= gravity * delta
      # Handle jump.

      if Input.is_action_just_pressed("jump") and is_on_floor():
      velocity.y = JUMP_VELOCITY

      # Get the input direction and handle the movement/deceleration.
      # As good practice, you should replace UI actions with custom gameplay actions.
      var input_dir = Input.get_vector("left", "right", "up", "down")
      var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()

      if direction :
      velocity.x = direction.x * current_speed
      velocity.z = direction.z * current_speed
      else:
      velocity.x = move_toward(velocity.x, 0, current_speed)
      velocity.z = move_toward(velocity.z, 0, current_speed)

      # Update animation states
      $AnimationTree.set("parameters/conditions/idle", input_dir == Vector2.ZERO && is_on_floor())
      $AnimationTree.set("parameters/conditions/fall", !is_on_floor())
      $AnimationTree.set("parameters/conditions/land", is_on_floor())
      $AnimationTree.set("parameters/conditions/walk", input_dir.y == -1 and is_on_floor() and not is_running)
      $AnimationTree.set("parameters/conditions/back", input_dir.y == 1 and is_on_floor() and not is_running)
      $AnimationTree.set("parameters/conditions/right", input_dir.x == 1 and is_on_floor() and not is_running)
      $AnimationTree.set("parameters/conditions/left", input_dir.x == -1 and is_on_floor() and not is_running)
      $AnimationTree.set("parameters/conditions/run", input_dir != Vector2.ZERO and is_on_floor() and is_running)

      move_and_slide()
      func toggle_sprint():
      is_running = not is_running
      current_speed = running_speed if is_running else walk_speed

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

    My springarm just does not work it is already clipped under the floor when I start and when I tried to move the CameraController node nothing changed and when I changed the position of the springarm it would appear as if the care is right above the players head like a first person and yes the collision masking is properly done but it just won't work

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

      i had a similar issue and it was because i used a different model which had a completely different scale. So I had to change the boundaries of the clamp and also increase the SpringArm length by a lot.

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

    what would I need to change for the character to face the direction he's walking, instead of towards where the mouse is pointing? so instead of strafing right, my character will just face right, and when going backwards, my character will face the camera?

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

      I am going to be updating this tutorial soon to add this I just need to iron out some small stuff

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

      @@FinePointCGI looking forward to it, thanks for your reply!

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

    Perfect but i think the player dont need to go back

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

    Sir please provide the character download link that you used sir please

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

      The character I used is owned mixamo you need to go into there character tab in the top right click characters. Underneath there should be a bunch of characters that you can use including the one I used in this video!

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

      @@FinePointCGI i got that sir but the character is not having animation I try to add it but i can't make it properly so please make a new one with any character skin and send it's download link sir please.

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

    Hi, what program are you using to display keystrokes?

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

    at 18:30 for some reason my Godot is saying "Node Not found: "LookAt" (relative to root/Node3D/MeshInstance3D)" i tried to copy everything that you did

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

      Double check the path to the node it's possible the look at node may be tucked under something else.

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

      @@FinePointCGI tyy it was the path node :D

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

    Bhai please please please please please please pura same yahi chij ki hai lekin joystick kese lau batado please 😢😢😢😢

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

    If you name the animatios to "idle cycle" "walk cycle" and so on...they repeat by default.

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

    this looks so painfully finnicky. is there really no easier way to do this?

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

      I have a follow on that shows a slightly better way to handle the animation transitions using 2d blending

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

      @@FinePointCGI thanks for the reply.
      yes I found that solution later after commenting. What Im currently considering is maybe connecting several blend2ds with the statemachine instead or maybe replace it entirely with BlendTree as it seems to exponentially increase in complexity the more animations you have.
      it is faster to set up with few animations though.

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

    That's a lot of coding for a simple action!