BEST godot tutorial EVER! this should be the best godot channel and everyone should know!
@necaton3 жыл бұрын
please upload some more godot tutorials. they are the best on the whole internet!
@TheLastPhoen1x11 ай бұрын
Omg thank you, finally someone explain clearly and properly how to align object with surface! Amazing!
@Ayteo.Ай бұрын
did this tutorial work on godot 4?
@TheLastPhoen1xАй бұрын
@@Ayteo. Math is the same, you just use move_and_slide() and floor_stop_on_slope=true instead of move_and_slide_and_snap().
@Ayteo.Ай бұрын
@@TheLastPhoen1x thank you
@MagmaSloth642 жыл бұрын
If anyone following through this tutorial experiences a weird grey screen after calling on the raycast, followed by the det == 0 error in the debugger, you need to add this if statemet before using a method on the raycast. It seems this can solve most problems related to raycasts is to just first check whether or not they're actually colliding before performing some function with them. if $RayCast.is_colliding():
@npc_blob16092 жыл бұрын
My vehicle still doesn't behave correctly, the axis it aligns to is wrong, it passes through surfaces sometimes, jitters etc.
@MagmaSloth642 жыл бұрын
@@npc_blob1609 this is the next problem I'm trying to solve. If you're experincing the same issue I am, it's because your player model is a large rectangle or otherwise covers an area much larger than what that single raycast could reliably cover. In my case my character is a slug; basically an elongated shape with a single raycast in the center. Because of this, the nose of the model can ride up a steep slope lifting the raycast off the ground before it has a chance to collide with the ramp, causing all sorts of weird collisions. My solution to this is to add more rays, and organize them in a folder. You can do this by creating a basic node and organizing all your characters rays as children of that node. Let's say you call the node "rayfolder", you'd wanna create a for loop that iterates over all the rays in rayfolder, then orients the player to an average of all rays for each frame. Something like for ray in $rayfolder: I set this project down for a minute so I haven't come up with the exact solution yet, but I'm getting my ideas from the "how to climb any wall" tutorial by NAD LABS here on KZbin, check that out and ponder over it, and a light bulb may come on over your head Good luck! :)
@BrianRogers3D4 жыл бұрын
Well done! You're a very good teacher
@Kidscancode4 жыл бұрын
Thank you! 😃
@hirochima264 жыл бұрын
well i guess you love tanks ( thnx for you tutorials
@Kidscancode4 жыл бұрын
Lol, it seems that way!
@rorballfrias17504 жыл бұрын
More videoss plisss ................... SO much waiting ....................
@mitchellstephens42284 жыл бұрын
please keep doing more vids
@thefamousrat88523 жыл бұрын
Super video ! Solved a similar problem I had within minutes. Thanks !
@Engoneer Жыл бұрын
this is taught so well, one of the best tutorials on youtube
@fernanboxfrias3814 жыл бұрын
Upload please
@MrBoczald4 жыл бұрын
I love your videos. I started learning with them. Before that, it was hard for me to start anything. Now I have my way, thanks!
@viniguerrero4 жыл бұрын
Nice video Chris! If I could give a suggestion for another tutorial, I'd say how do you identify if a KinematicBody is Jumping or Falling when is_on_floor is false, curious to see your approach on cases like this. Your videos help me a lot! Thank you for all the great content, keep it up
@codingkam12524 жыл бұрын
Maybe : if !is_on_floor: if velocity.y < 0: jump() elif velocity.y
@viniguerrero4 жыл бұрын
@@codingkam1252 does that assume ground.y starts in 0 or could use like have a platform in y-20 where that is considered as the ground?
@bitmammothOG4 жыл бұрын
@@viniguerrero Since its only affecting velocity it should be fine.
@cmds.learning74264 жыл бұрын
Great video, thank you!
@lifesymbiont57693 ай бұрын
thank you for making this
@ara75464 жыл бұрын
i get this error ERROR: Basis must be normalized in order to be casted to a Quaternion. Use get_rotation_quat() or call orthonormalized() instead.
@root-kg6uz4 жыл бұрын
I have the same problem and same error, and then the camera sets on the tank and can only go forward I am using linux and have a compiled version of godot with zylann but also happens in stable 3.2.1
@BelfortDev3 жыл бұрын
I have the same problem and same error too
@mrnalaiq31964 жыл бұрын
I love your videos
@barellevy60304 жыл бұрын
Great video, thank you! Was wondering, can I take the average normal of all the edges we are colliding with?
@Kidscancode4 жыл бұрын
Sure - that's essentially what the raycast is doing.
@J_A_C0236 ай бұрын
Its not quite accurate on a sphere, from what I did. Along the 'equator' of the sphere, my test character actually starts to rotate a bit to the side and then the further I go away from the 'equator', it begins to rotate back. Is this due to some global y somewhere, where it become 0 at that point or something?
@J_A_C0236 ай бұрын
I came up with a better way (for my script at least). First get the vectors of the normal by reverse calculating the cross products and put them in an array and return that to the physics_process, then in the physics_process, call it with a variable, something called 'vectors' or whatever. Then use that array [0, 1, 2] as x, y, z (or other order needed since its a basis transform), and then say rotation_basis = Basis(vectors[2], vectors[1], vectors[0]) and ortho that to keep the scale. Then, you can make a new Transform and use it's method 'looking_at' since I don't think kinematicbody 3d has any look methods, might just be rigid idk but I dont think it does. And within that Transform make it look at vectors[2], vectors[1], because those are the x, and y cross products like how you used them to fix the orientations, and you can then simply set the global_transform.basis to = rotation_basis. Hopefully that makes sense lol.
@J_A_C0236 ай бұрын
Nvm your way is better :P
@proatgaimz3 жыл бұрын
i am having trouble rotating on my local y axis while this function is running. or the rotating works but the alignment with the terrain gets paused while i am rotating.
@mrquivy71566 ай бұрын
there is a problem when I converted this to C# the formula works but just bearly, this is the function code private Transform _bruh(Transform Xform, Vector3 normal) { Xform.basis.y = normal; Xform.basis.x = -Xform.basis.z.Cross(normal); Xform.basis = Xform.basis.Orthonormalized(); return Xform; } the kinamtic body rotates to the surface normal but it does not rotate to it correctly leaving the body rotated just alittle bit off to the side. making the body slide around the floor like it's ice or somthing. Please help me with this I don't know why it's doing this.
@nowherebrain2 жыл бұрын
stupid question, but could you not do this with the built in function using a vector3.left instead of vector3.up?....e.g. look_at(collision.point,Vector3.LEFT)??? I have not tried this..I'm simply here because I want to research this before I blindly do something stupid that will cause me to do a bunch of vector subtraction and then setting rotations semi manually. Love your site and channel BTW. thumbs up given.
@santoshgujar52374 жыл бұрын
Sir Please can you add a Tutorial 2d racing game where vehicle move left right and background move left right, like old days, Please its a Request
@cmds.learning74264 жыл бұрын
hi MR KidsCanCode 。。。waiting you for a long time..where are you ?
@douglasmatos76523 жыл бұрын
This didn't work for me....I need to align a hoverbike in concave tubes....anyone please help me...I dont understand how to manipulate raycasts in godot...I'm very frustrated at really because the visuals are ok...the most mechanics is ok...but....the terrain alignment..not ok.....
@fernanboxfrias3814 жыл бұрын
How did you change the color of the letter of the script
@OGTV1up4 жыл бұрын
also love your vids chris
@abdiel33582 жыл бұрын
you are a life saver!! :')
@mina75724 жыл бұрын
Can you explain Gravity Point for Area2D in Godot? I made an Area2D as a child of a RigidBody2D and set all the gravity point related settings on, but it doesn't attract any instances of itself when they get within each others Area2D collisionshape. Is there an alternative way to make a RigidBody2D have gravity or to be sticky or magnetic with instances of itself?
@ara75464 жыл бұрын
can you do same tutorial but with character ? (kinematic character, rigid)
@tomaszgoral81543 жыл бұрын
Would I be able to get the angle of the normal by getting the dot product from the up vector 3 and the ground normal?
@thezadek4 жыл бұрын
doesn't this allow the tank to climb the walls?
@Kidscancode4 жыл бұрын
The downward facing raycast isn't going to hit a vertical wall. But you can also check the angle of the normal before you rotate - use the dot product and if it's above a certain value, don't align.
@npc_blob16092 жыл бұрын
Could you provide an example project file to compare to in future? This straight up doesn't work in the current version, seizure-inducing camera snapping to new angles, quaternion errors, rotating to face the wrong axis on inclines, etc at different stages of the video, even when copy-pasted straight from the KidsCanCode page.
@Kidscancode2 жыл бұрын
You may have something wrong with your models and/or your collision setup - it's not just the code. I opened the old project in 3.5 and it works perfectly fine. Here is the project - there are several example scenes in there, see the "3DExample" folder for this video's content. github.com/kidscancode/shooting_demos
@npc_blob16092 жыл бұрын
@@Kidscancode Thanks for the reply. You're right, the project works in the current version. I'm really confused then - I've made sure the transforms in my vehicle scene are at 0 facing negative Z, tried many different collisionShapes keeping them simple and trying to match what's in the tutorial, different raycast lengths etc, but it still messes up.
@jumageorge54054 жыл бұрын
Hello! Can godot make a steering wheel control for android driving game
@FlamingFoxProd2 жыл бұрын
So, this tutorial has mostly worked perfectly, right up until the part where you added the RayCast and changed the code to reflect that. For some ungodly reason, despite my code being entirely identical to yours, when I change the code to reflect what you do at 12:20, when I run the game, the screen is entirely grey. When I change the camera to be stationary and not parented to the player, I just... don't see the player. And the debugger keeps saying "Invert: Condition "det == 0" is true". I don't know what any of this means, and why exactly doing the exact same thing you did is causing the code to completely break despite it working exactly the same just before that.
@MagmaSloth642 жыл бұрын
SAAAME! I've been seriously scratching my head about this, I believe it could be related to updates with the engine changing the functionality of the code. I've realized the interpolated camera utilized in the last tutorial has been deprecated and removed for godot 4 and apparently no longer works in versions of godot 3. Thankfully he's included what appears to be a fix for it, on the "interpolated camera" page on the KidsCanCode website, although I haven't gotten that working yet but I'm grateful there is a fix. What this does show us though is that as the Godot landscape changes old methods and ways of doing things may break and have to be re-engineered. I'm going to try and find a fix for this, I've been using this video as an invaluable resource and I'm very happy that KidsCanCode has taken the time to share this knowledge. I feel like the fix could be something simple and have to do with the way the nodes $raycast is being accessed that somehow breaks the whole thing. I'm going to mess around with the Climbing System developed by Nad Labs on youtube, as it does something very similar. I'll reach out to the Godot Community on discord as well to see if anyone is familiar with this, because I am in great need of finding a solution. I'll let you know if I come up with something, I'm running into that same error: Error: Invert: Condition "det == 0" is true. C++ Source: core/math/basis.cpp:69 @ Invert()
@MagmaSloth642 жыл бұрын
UPDATE: I'll update this with my findings. I saw in the video he's using the stable Godot 3.2.1 release while I was using the mono build of 3.2.3, and although I've tested this scene on 3.5 and on 3.2.1 to see if maybe it only worked on the slightly older version, I've ruled this out as a potential cause since the problem still occurs. This leads me to believe there is some sort of dependency in his setup possibly reliant on a previous tutorial that was not mentioned in this video. SOLUTION: Found the solution, simply add this before calling the .get_collision_normal() method on the $RayCast: if $RayCast.is_colliding(): So it'd look something like this: if $Rayzor3.is_colliding(): var normy = $Rayzor3.get_collision_normal() var xform = align_with_y(global_transform, normy) global_transform = global_transform.interpolate_with(xform, 0.2)
@nabilabedkarim71124 жыл бұрын
HELLO i got a problem. i wich i can get your help when i try to open godot this masseg show up : your video card driver does not support any of the supported opengl versions and i cant update my windows 7 because is pirated can you help me pls
@merterisen4 жыл бұрын
I should learn Python for my job but also I want to make a game 2D to phone hobby. What you suggest me to learn unity or godot or pygame?
@Lachrymogenic2 жыл бұрын
this really didnt work for me, as when i tried it, my character rotated into the floor.
@mitchellstephens42284 жыл бұрын
Can someone please help me with this, this is the most frustrating experience of my life. Im on mac. Whenever I open Godot, it loads fine. When I select the project I want to work on, it opens a new Godot app that actually runs the file. Yeah, it works. But I have to keep moving one instance of the application to the trash every time I close the app. I end up having 3-4 instances of the Godot app in my toolbar for no reason.
@tomaszgoral81543 жыл бұрын
I think you should go to the godot community and ask there. You might find someone who fixed this problem, best of luck!
@mrlonely4204 жыл бұрын
sup man, can you do a tutorial about json and make a save system like checkpoints ? I've been trying to figure it out but couldn't
@Kidscancode4 жыл бұрын
JSON shouldn't be used for saving data. godotrecipes.com/basics/file_io/
@tomansionpercussion43894 жыл бұрын
the camera is rotating too
@qqq95424 жыл бұрын
Thank u so much!! Can this be applied to 2D as well?
@Endgame9013 жыл бұрын
I mean this is a year old now but Is there a reason you don't use multie raycasts around the player object and average the normal between them?
@tradingwithwill72144 жыл бұрын
Can you do Oculus Quest VR game with Godot for newbs? Thanks
@Kidscancode4 жыл бұрын
If you send me an Oculus Quest, I'll be happy to do so. :)
@jamesxxxyz87754 жыл бұрын
How the tank can topple over when angle is too large?
@Kidscancode4 жыл бұрын
You'd need to check the angle of the normal.
@jaxamus133 жыл бұрын
Where did u go
@OGTV1up4 жыл бұрын
yay im finaly one of the first person to type something in a video
@codingkam12524 жыл бұрын
the stop on slope function doesnt work in the newest version of godot, how do you stop sliding on a slope
@Kidscancode4 жыл бұрын
See the previous video. `move_and_slide_with_snap()` works well.
@codingkam12524 жыл бұрын
@@Kidscancode I found a video with a very simple fix heres the link: kzbin.info/www/bejne/qJipg359fNasbNk it worked perfectly fine for me
@ferozakbar4 жыл бұрын
hello KCC, can you please share the source code of 2d version of this, im stuck at many places. thanks in advance
@linuxrant Жыл бұрын
hey, wonderful tutorial. You wouldn't have an idea how we could do the same thing but with a rigid body? My rigid body spaceship, has a problem when using global_transform (Error setting property 'global_transform' with value of type Nil.) I'd appreciate some advice how to do what you did with a rigid body :)
@Kidscancode Жыл бұрын
That error means you're trying to assign it a value of "null". Whatever variable you're trying to assign to `global_transform` doesn't have a value.
@linuxrant Жыл бұрын
@@Kidscancode thx for a reply, I understand that, I don't understand why that happens, I don't know how to learn how rigid body code works.
@Kidscancode Жыл бұрын
@@linuxrant The best way to learn how rigid bodies work is to read the docs. docs.godotengine.org/en/stable/classes/class_rigidbody.html
@ara75464 жыл бұрын
i have a question about performance. Your kinematic object, does he get applied by engine physics ?
@Kidscancode4 жыл бұрын
I don't understand the question.
@ara75464 жыл бұрын
@@Kidscancode do you use godot physics or bullets ?
@Kidscancode4 жыл бұрын
I'm using the default bullet physics.
@ara75464 жыл бұрын
@@Kidscancode have you tried to switch off physics and use raycast only, i am asking myself if it will boost fps ?
@arielgimenez_954 жыл бұрын
source code?
@AnKlMa3 жыл бұрын
Do you have to do this manually in Godot? Like in the UPBGE there is a function called alignAxisToVect() Also in another video with the homing missiles you programmed the tracking manually. Isnt there a built-in function like trackTo() (which the upbge also has)? Don't get me wrong, I love to see what is going on behind the curtains and I never really thought about that
@kimiscool49994 жыл бұрын
Try this command on python import turtle fred = turtle.Pen() fred.shape("turtle") fred.speed(1) for i in range(4): fred.forward(100) fred.right(90) fred.up() fred.forward(200) fred.down() for i in range(4): fred.forward(100) fred.right(90) fred.up() fred.forward(200) fred.down() for i in range(4): fred.backward(100) fred.right(90) for i in range(4): fred.backward(100)
@jamesxxxyz87754 жыл бұрын
You can use this kzbin.info/www/bejne/eJ-QqmZujMllqKc and kzbin.info/www/bejne/oZOxknR5rtaXd7s to create a tutorial(s). You can put a turret on this vehicle and continue how to shoot and rotate with it...
@Lion_McLionhead2 жыл бұрын
The lion kingdom has found it very difficult to align with walls when sliding along walls. It seems it would take 2 more raycasts to detect the wall normals.
@user-mz9mq3jk8d Жыл бұрын
wtf
@McDADDyK4 жыл бұрын
can you reply to older video questions or set up a patreon so we can pay to get answers...
@Kidscancode4 жыл бұрын
I answer questions when I have time to answer questions. Spamming doesn't make it happen faster.
@OGTV1up4 жыл бұрын
and one more thing im 9 and right now on your python vids you should do some more i like them and i do them and have alot of fun with my mom and dad and if my brother was a few more years older i would be haveing fun with him to
@OGTV1up4 жыл бұрын
yep i do python oh and sorry for spam again im a kid
@nabilabedkarim71124 жыл бұрын
i got a problem. i wich i can get your help when i try to open godot this masseg show up : your video card driver does not support any of the supported opengl versions and i cant update my windows 7 because is pirated can you help me pls
@nabilabedkarim71124 жыл бұрын
i got a problem. i wich i can get your help when i try to open godot this masseg show up : your video card driver does not support any of the supported opengl versions and i cant update my windows 7 because is pirated can you help me pls
@nabilabedkarim71124 жыл бұрын
i got a problem. i wich i can get your help when i try to open godot this masseg show up : your video card driver does not support any of the supported opengl versions and i cant update my windows 7 because is pirated can you help me pls
@nabilabedkarim71124 жыл бұрын
i got a problem. i wich i can get your help when i try to open godot this masseg show up : your video card driver does not support any of the supported opengl versions and i cant update my windows 7 because is pirated can you help me pls
@proatgaimz3 жыл бұрын
There's free operating systems like Linux if you don't want to pay for an operating system
@nabilabedkarim71123 жыл бұрын
@@proatgaimz very good but can you explaine more please
@nabilabedkarim71124 жыл бұрын
i got a problem. i wich i can get your help when i try to open godot this masseg show up : your video card driver does not support any of the supported opengl versions and i cant update my windows 7 because is pirated can you help me pls
@seubmarine53473 жыл бұрын
Your computer is too old
@nabilabedkarim71123 жыл бұрын
@@seubmarine5347 ok.......
@seubmarine53473 жыл бұрын
@@nabilabedkarim7112 It can't open godot because it's too old, it doesn't have graphic card that suport opengl
@nabilabedkarim71123 жыл бұрын
@@seubmarine5347 nah...... i already fix it with some program but thanks anyway
@nabilabedkarim71124 жыл бұрын
i got a problem. i wich i can get your help when i try to open godot this masseg show up : your video card driver does not support any of the supported opengl versions and i cant update my windows 7 because is pirated can you help me pls