Godot 3.1 Tutorial 3D Movement (2) Free Range Flying
Gingerageous Games
Views: 3664
Like: 83
3D movement that is actually useful. Very basic movement but usable.
29.03.2022
10 Comments
so i finally figured out why your ship was drifting at 1:30. -transform.basis.z tells you what direction you are pointing relative to the parent. so, if you rotate right 90 degrees, you get (1,0,0) and NOT (0,0,-1)the translate method tells the ship how to move relative to ITS SELF (local coordinates)! this means that if you pass transform.basis.z, which is (1,0,0), you are telling the ship to move in its positive x direction.later, when you pass the movement_guide.transform.basis.z, that vector always points at (0, 0, -1) because, remember, it's relative to the parent and since you never rotate that object it's always pointing in the -z direction so it's basis.z never changes. Then the translate() function tells the ship to move in its -z direction because basis.z is always (0,0,-1)if this is still confusing, try doing print_debug() and print the basis.z under both conditions and you'll see why. Or i can make a video since i need to make one for this eventually anyway. Honestly, the problem is that Godot's documentation does not specify in which coordinate system it works in nor does it specify if it's relative to anything or not. This should be changed because people have to figure out how these functions were designed since they don't clarify.Another thing to note and be careful of, you are mixing and matching a few things, rotations+translations with transforms+transform.basis. these are 2 different systems for describing position and rotation and you should try not to mix and match them. You also call translate() ,which changes local space but pull values from parent space (which is equal to global space in this case) and you need to convert carefully when you do this. Also avoid doing this if you can but it's harder to avoid.finally, you should use move_and_slide() instead as @Flairetic said because this will check for collisions but translate() wont.
Wowza! So much Great tuts from many people in the last year. This reminds me of Kingdom Hearts when you fly your gummi ship from planet to planet. I will be trying this tomorrow 😀 thanks!
thanks buddy. I just searched for it from past 2 weeks but, didn't find it. and then your video appear in YT. looking for more like this. ( please make advance flight physics like in real big games ) I just want to create a similar game like, ace combat 7. I have all models ready. leki, SU-30, SU31. but, don't know how the physics of fighter jet works and implement them. great.
I need some help, ive been wanting to make a more space like control where you can look in any direction but the z axis when I try this always causes my controls to invert is there anything I can try?
Coincidently I was working on a similar game, I have all my movements and collisions figured out, only the rotation part was bothering me. Now I got that sorted out too thanks alot.
so i finally figured out why your ship was drifting at 1:30. -transform.basis.z tells you what direction you are pointing relative to the parent. so, if you rotate right 90 degrees, you get (1,0,0) and NOT (0,0,-1)the translate method tells the ship how to move relative to ITS SELF (local coordinates)! this means that if you pass transform.basis.z, which is (1,0,0), you are telling the ship to move in its positive x direction.later, when you pass the movement_guide.transform.basis.z, that vector always points at (0, 0, -1) because, remember, it's relative to the parent and since you never rotate that object it's always pointing in the -z direction so it's basis.z never changes. Then the translate() function tells the ship to move in its -z direction because basis.z is always (0,0,-1)if this is still confusing, try doing print_debug() and print the basis.z under both conditions and you'll see why. Or i can make a video since i need to make one for this eventually anyway. Honestly, the problem is that Godot's documentation does not specify in which coordinate system it works in nor does it specify if it's relative to anything or not. This should be changed because people have to figure out how these functions were designed since they don't clarify.Another thing to note and be careful of, you are mixing and matching a few things, rotations+translations with transforms+transform.basis. these are 2 different systems for describing position and rotation and you should try not to mix and match them. You also call translate() ,which changes local space but pull values from parent space (which is equal to global space in this case) and you need to convert carefully when you do this. Also avoid doing this if you can but it's harder to avoid.finally, you should use move_and_slide() instead as @Flairetic said because this will check for collisions but translate() wont.
you are such a bad pilot 😛 anyways. thanks for the tutorial!
Wowza! So much Great tuts from many people in the last year. This reminds me of Kingdom Hearts when you fly your gummi ship from planet to planet. I will be trying this tomorrow 😀 thanks!
use move_and_slide() instead of translate with kinematic bodies if you want collisions.
thanks buddy.
I just searched for it from past 2 weeks but, didn't find it. and then your video appear in YT.
looking for more like this. ( please make advance flight physics like in real big games )
I just want to create a similar game like, ace combat 7.
I have all models ready. leki, SU-30, SU31. but, don't know how the physics of fighter jet works and implement them. great.
my plane is going to the right for some reason
I need some help, ive been wanting to make a more space like control where you can look in any direction but the z axis when I try this always causes my controls to invert is there anything I can try?
use vector3's they are way easier
Awesome!! this video was really useful!!
I was searching on youtube ''How to do 3D movement for vehicles?'
and this video showed up
Coincidently I was working on a similar game, I have all my movements and collisions figured out, only the rotation part was bothering me. Now I got that sorted out too thanks alot.