*First!* Even _before_ the video was out :o To add a few notes on top of the video: steering behaviors work well for player-controlled vehicles in top-down games, beyond AI. For AI, if you want a companion that follows the player (i.e. companion), you can use the seek behavior. And you can even make it avoid obstacles with the avoidance behavior, but also steer along the path you get from the A* algorithm so it looks like your character is walking naturally through the world and not on a grid.
@MsKocagoz6 жыл бұрын
Hi GDquest, I cant move my tank to rotated direction, can you help me, I saw your steering car tutorial but it is based kinematic body, mine is area2d, so I cant implement to my code, your help will be highly appreciated.
@OBalduriano5 жыл бұрын
Does "avoidance behavior" have any video explaining it? Or can you indicate?
@renanstn76595 жыл бұрын
If you are using Godot 3.1, here's the code with some adaptations i've made: const MAX_SPEED = 300 const MAX_FORCE = 0.02 export (int, "Seek", "Flee") var mode = 0 var velocity : Vector2 var target : Vector2 func _physics_process(delta): target = get_global_mouse_position() velocity = steer(target) move_and_slide(velocity) func steer(target : Vector2) -> Vector2: var helper= (target - get_position()).normalized() * MAX_SPEED var desired_velocity = Vector2(helper.x, helper.y) if mode == 1: # Flee desired_velocity = -desired_velocity var steer = desired_velocity - velocity var target_velocity = velocity + (steer * MAX_FORCE ) return target_velocity
@s.u.h.65484 жыл бұрын
Thank you.
@boerbol94222 жыл бұрын
thanks for posting, so we can all learn from this!!
@Seffron Жыл бұрын
Don’t suppose anyone has an idea of how to get this to work in Godot 4? 😩
@felixlipski39564 жыл бұрын
this tutorial is a godsend if you want to treat your kinematic body as physical object and apply force to it. I used it to implement a grappling hook, a jetpack and gravity.
@pigdev4 жыл бұрын
That's awesome that you found that kind of application for this technique. Congrats, looking forward to see the game released!
@adhidwipa60277 жыл бұрын
Interesting concept behind of moving naturally or I called it smart moving.
@urchinvalero65297 жыл бұрын
Amazing video, and much thanks! The background music in the video IS a good addition, but its high volume makes it too distracting.
@pigdev7 жыл бұрын
Thanks! Yeah, I never find a good balance between music and voice volume :/ but I'll keep trying. Thanks for the feedback :D
@cesarfernandez23685 жыл бұрын
Thanks bro!. this is a very useful and interesting video!
@ВікторГаврилюк-х2ч4 жыл бұрын
Question: we multiply velocity by delta to insure it doesn't depend on framerate. Don't we need to multiply steering by delta too, so that change in velocity remains stable too?
@wolliel7 жыл бұрын
Thanks, this was interesting and easy to understand.
@jwerlley6 жыл бұрын
very nice Piggy!!
@OBalduriano5 жыл бұрын
How to make an object chase the target, but turning around if you already have an ally in front, for example, a hero vs 3 creatures? They will clamp one after the other and need to turn around. How would you do that at Godot?
@pigdev5 жыл бұрын
Check it out this : gamedevelopment.tutsplus.com/tutorials/understanding-steering-behaviors-queue--gamedev-14365
@froyorex48565 жыл бұрын
Can you update this please?
@Artfrost6 жыл бұрын
on godot 3.0 does not work
@RREDesigns7 жыл бұрын
Would you show us how to create nodes from a script and make them stay permanently in the editor node tree? I tried all the methods suggested in the Q&A page, but it doesn't work.
@pigdev7 жыл бұрын
RRE Designs Sure, I'll research it and will make a post to my blog or a simple video, deal?
@RREDesigns7 жыл бұрын
That would be super cool. I must warn you that I looked everywhere and did a lot of attempts but no luck. I am working in the 3D editor, though I guess it should work just the same. Also, I am trying to make a little script to spray grass sprites on any mesh, but the MeshDataTool get_vertex_count() method returns the count of tris and not the count of vertices. If you can check into that as well I would appreciate it. I think it is a bug, but I have to be sure before reporting it. I can provide all the assets if you want. Saludos desde Argentina garoto! xD
@pigdev7 жыл бұрын
RRE Designs well 3D is not my thing for now unfortunatelly, so I can't cover this yet :c
@RREDesigns7 жыл бұрын
I see. Well, forget about the mesh then, but you can still try to add nodes in the 3D editor from a script, it should be the same I think. ;)
@r1c4rd007 жыл бұрын
Muito legal. Parabéns! Vai sair uma versão PtBr?
@pigdev7 жыл бұрын
Non :( no máximo eu vou adicionar legenda. Os vídeos agora só saem em EN :/
@r1c4rd007 жыл бұрын
Tudo bem. A legenda já ajuda muito quem não tem o inglês afiado. Muito obrigado. Parabéns pelo trabalho.
@Roule_n_Scratche2 жыл бұрын
Valeu pelo video
@pigdev2 жыл бұрын
Obrigado por assistir! 😅💜
@faisalwachid44182 жыл бұрын
Do you have a link to learn math for game programming
@pigdev2 жыл бұрын
For math...well is a general topic. But here's the one for steering. This site has other, e.g. vectors. gamedevelopment.tutsplus.com/categories/steering-behaviors
@PiggyPigginton5 жыл бұрын
I like your channel
@snstarosciak4 жыл бұрын
Hey there, I love the music in the beginning of your video haha would you happen to have a link to that so I can listen to it some more? :)
@pigdev3 жыл бұрын
Yep, it's on the video's description: incompetech.com/music/royalty-... Artist: incompetech.com/
@rishianands84725 жыл бұрын
Hai Pigdev ,, can you please make this in 3d where the enemy (kinmaticBody) follows and collide with the player(kinematicBody)
@me2beats3135 жыл бұрын
Subsribed
@xlxs15 жыл бұрын
Twitter link in video description is incorrect
@pigdev5 жыл бұрын
Ohh thanks for the headsup!
@Marvin-t3e5 жыл бұрын
I'm sorry but you couldn't break it down enough so a beginner can understand it (since we are coming from a beginners tutorial) this seems like rather advanced stuff to implement. It would have been cool if you could have drawn pictures for better understanding while writing the code and reiterate it after, so we could have something to look at for better understanding. Maybe next time :) teaching something is pretty hard after all, since you have to completely understand it in order to break it down enough for everyone to understand. Cheers!
@sierz.stradtord78834 жыл бұрын
I would like to see what each of these lines do, well I know that you can infer what the normalize function does etc. but a more indepth breakdown with running the code and seeing the results after adding each line would be really helpful.
@mauricioyaman5707 жыл бұрын
I folow you my frien, i`m Lack of Love
@Draxacon7 жыл бұрын
your tutorial was great! keep making more, i will definitely be using this behavior. I am trying to adapt this system to a player movement script, and, I've been having a few issues. I am trying to use it for super smooth movement, giving it a turn-rate. If anyone has any ideas, that'd be great! pastebin.com/8Y6TMvtQ I cant figure out how to get it to stop, once the key(s) are released, so it goes on forever, and only moves diagonally, because target_direction's values don't return to 0. I tried something like this, but that didn't seem to work. I think its because the Transition Vector doesn't stop following the target_directions value if Input.is_action_just_released("move_up"): direction.y = 0 elif Input.is_action_just_released("move_down"): direction.y = 0 Thank you
@pigdev7 жыл бұрын
Draxacon I think we can solve this with the arrival behavior, sorry for the delay, it is supposed to be recorded and published at the first week of July
@Draxacon7 жыл бұрын
ok, thank you so much! ill be sure to check that out!
@pigdev6 жыл бұрын
6:03 this is not a state machine, NOOB!
@balaportejean70155 жыл бұрын
thx bro Jesus loves you Believe in him and repent
@pigdev5 жыл бұрын
Amen, brother. Jesus loves you too. Thanks for the kindness.