Тёмный

Godot 3: Kinematic to Rigid Body Interaction 

KidsCanCode
Подписаться 61 тыс.
Просмотров 40 тыс.
50% 1

Опубликовано:

 

28 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 120   
@GameEndeavor
@GameEndeavor 5 лет назад
Fantastic topic. I absolutely loved the article on this and have already used this several times in my work.
@Kidscancode
@Kidscancode 5 лет назад
Glad it helped!
@Jonathan.R.Pereira
@Jonathan.R.Pereira 3 года назад
@@Kidscancode Hi there, I'm unable to move objects.
@Jonathan.R.Pereira
@Jonathan.R.Pereira 3 года назад
@@Kidscancode This is the code I'm using, what am I doing wrong? : extends KinematicBody2D var motion = Vector2() const UP = Vector2(0, -1) const GRAVITY = 20 const ACCELERATION = 50 const MAX_SPEED = 200 const JUMP_HEIGHT = -550 export (int, 0, 200) var inertia = 100 func get_input(): var friction = false if Input.is_action_pressed("Player_Left"): motion.x = max(motion.x-ACCELERATION, -MAX_SPEED) elif Input.is_action_pressed("Player_Right"): motion.x = min(motion.x+ACCELERATION, MAX_SPEED) else: friction = true if is_on_floor(): if Input.is_action_just_pressed("Player_Jump"): motion.y = JUMP_HEIGHT if friction == true: motion.x = lerp(motion.x, 0, 0.2) else: if friction == true: motion.x = lerp(motion.x, 0, 0.05) func _physics_process(delta): #Calling the Input Functions get_input() motion.y += GRAVITY motion = move_and_slide(motion, Vector2.UP, false, 4, PI/4, false) for index in get_slide_count(): var collision = get_slide_collision(index) if collision.collider.is_in_group("bodies"): collision.collider.apply_central_impulse(-collision.normal * inertia)
@susmiasyaefudin5000
@susmiasyaefudin5000 5 лет назад
That is really great help indeed! My kids have put a beach ball in there first level and it's a rigid body. It's great fun to interact with the ball but after a short time the ball is lost because it's pushed into the floor. We are gonna try the piece of code you provide so kindly.
@susmiasyaefudin5000
@susmiasyaefudin5000 5 лет назад
Kids are 7 and 13 years old.
@rafaeu292
@rafaeu292 3 года назад
Damn dude, its when i look at videos like this that i realize i know too little about Godot, i din't even know you could check for what you are colliding, neither getting theyr information, thx for the video man, you help thousands of people and that's sick, you're really talented and i really respect people like you, thx again :)
@IronBrandon22
@IronBrandon22 4 года назад
This is a great tutorial, my custom physics engine for my game has broken several times because the rigidbodies kept going through the world
@LucyJong
@LucyJong 5 лет назад
I wondered how this worked for so long, thank you for this video!
@chepulis
@chepulis 5 лет назад
Exactly what i needed. You're great, as always.
@Kidscancode
@Kidscancode 5 лет назад
Thanks!
@copperbadge1
@copperbadge1 4 года назад
Fiddling with the properties and PhysicsMaterialOverride of my RigidBodies resulted in unexpected behaviour and after some questioning of my very understanding of physics, while temporary descending into madness, I can now safely say: Things make sense again. Thank you!
@ianmclean9382
@ianmclean9382 Год назад
still one of the best tutorials
@juliosardinha
@juliosardinha 4 года назад
Great! I applied this in 3D and it worked very well. Thanks!
@easyU2B
@easyU2B 4 года назад
Just what I was looking for! Thank you very much. This was a very informative and clear tutorial! :)
@freya9107
@freya9107 3 года назад
Thanks so much, this didn't completely fix my issue, but it definitely got me moving in the right direction.
@ARiverSystem
@ARiverSystem 5 лет назад
This was a really good tutorial and very relaxing to watch, cheers
@Kidscancode
@Kidscancode 5 лет назад
Thanks!
@candle-likeghost9523
@candle-likeghost9523 4 года назад
I found an issue here, when you try to stand on top of the rigidbodies, the kinematicbody is going to shake like hell. And if the rigidbody is on the kinematicbody, you cannot jump...
@tuxinal5661
@tuxinal5661 4 года назад
The reason that you cannot jump is that you are not standing on the ground you are standing on the rigid body which will not trigger the is_on_floor function
@HonsHon
@HonsHon 3 года назад
I know this is old, but holy crap this helped so damn much. Thank you so much
@jamesmunroe6558
@jamesmunroe6558 Год назад
Extremely helpful. Thanks!
@AdventurersTavern
@AdventurersTavern 4 года назад
this was exactly what i was hoping to achieve! great thanks!
@sirgrem2988
@sirgrem2988 4 года назад
For some reason, the apply_central_impulses were not in the auto-complete of the editor. I was damn confused.
@josephastrahan6403
@josephastrahan6403 5 лет назад
For those wanting to know how to do this in 3D, the code for the for loop looks like this, for index in get_slide_count(): var collision : KinematicCollision = get_slide_collision(index) var obj = collision.get_collider() if obj.is_in_group("bodies"): print(obj) collision.collider.apply_central_impulse(Vector3(inertia,0,0)) Only I don't have the vector3 correct for applying the impulse.
@Kidscancode
@Kidscancode 5 лет назад
You would still use the collision normal to align the impulse.
@josephastrahan6403
@josephastrahan6403 5 лет назад
okay I figured it out, for index in get_slide_count(): var collision : KinematicCollision = get_slide_collision(index) var obj = collision.get_collider() if obj.is_in_group("bodies"): collision.collider.apply_central_impulse(Vector3(inertia * -collision.normal.x,inertia * -collision.normal.y,inertia * -collision.normal.z))
@Kidscancode
@Kidscancode 5 лет назад
Or just collision.collider.apply_central_impulse(-collision.normal * inertia) If you need some help on working with vectors, there's a really good doc here: docs.godotengine.org/en/latest/tutorials/math/vector_math.html
@eyeemotion1426
@eyeemotion1426 4 года назад
Where is the "index" coming from? I get an error that index isn't declared in the current scope. I'm trying to get an object "fly off" when the car hits it. Thought that making the object a rigidbody would already make it interactable. There are so few tutorials about this (for Godot in 3D) or only partial information, it really gets annoying not being able to do things that should be straightforward.
@recarsion
@recarsion 3 года назад
This only seems to work if the RigidBody is at rest or low velocity. In my case I have a bucket that's a KinematicBody2D and you have to catch eggs that are falling downwards, which are RigidBody2D. Setting infinite inertia to false only made things worse, the smallest impact catapults the eggs out to the moon. I tested what happens if the eggs are still and the bucket hits them, and then it works, but not if they fall into the bucket or they have high velocity. I also tried using much simpler collision shapes, just in case the complex shapes are the cause but it still happens with the simplest rectangular shapes. Not to mention the eggs also move the bucket around, which is not supposed to be happening. I want the eggs to have absolutely zero impact on the bucket, but I want the bucket to be able to carry the eggs around, and that only seems to work with infinite inertia, but then the eggs get stuck in the bucket's hitbox. Is there any solution at all to this? I mean this all seems so trivial, there must be something we can do? Edit: I tried continuous detection too, doesn't work.
@Ruptured_AU
@Ruptured_AU 3 года назад
Any idea why (with infinite inertial = false) that my player CAN push things around but only for a short duration thenevetyhing becomes immovable. Its like it starts with some inertia that dispates. Cant figure out where it comes from.
@Jay_Bacal
@Jay_Bacal 5 лет назад
Fantastic tip!
@guru332
@guru332 5 лет назад
What a great video!! So well explained. Thanks so much!
@Kidscancode
@Kidscancode 5 лет назад
Thank you - glad you found it helpful.
@toadyproductions2106
@toadyproductions2106 3 года назад
EDIT: NVM FIXED the rigid body does not move but I can go on top of it. my script extends KinematicBody2D export (int) var speed = 200 export (int) var jump_speed = -600 export (int) var gravity = 1000 export (float, 0, 1.0) var friction = 0.1 export (float, 0, 1.0) var acceleration = 0.25 export (int, 0, 200) var push = 100 var velocity = Vector2.ZERO func get_input(): var dir = 0 if Input.is_action_pressed("ui_right"): dir += 1 if Input.is_action_pressed("ui_left"): dir -= 1 if dir != 0: velocity.x = lerp(velocity.x, dir * speed, acceleration) else: velocity.x = lerp(velocity.x, 0, friction) func _physics_process(delta): get_input() velocity.y += gravity * delta velocity = move_and_slide(velocity, Vector2.UP, false, 4, PI/4, false) if Input.is_action_just_pressed("jump"): if is_on_floor(): velocity.y = jump_speed for index in get_slide_count(): var collision = get_slide_collision(index) if collision.collider.is_in_group("bodies"): collision.collider.apply_central_impulse(-collision.normal * push)
@ssenna207
@ssenna207 3 года назад
how did u fixed it?
@toskunchik
@toskunchik 2 года назад
how did u fixed it
@toskunchik
@toskunchik 2 года назад
@@ssenna207 do you know how to fix this
@toadyproductions2106
@toadyproductions2106 2 года назад
@@toskunchik I don't really remember how fixed it anymore also it maybe because your using a different version of Godot
@deransartmatteo4774
@deransartmatteo4774 Год назад
Hi! thanks for this tutorial! The zip file is no longer hosted on your page, could you reupload it?
@DenerWitt
@DenerWitt 5 лет назад
I really wish physics were easier to mess with in any engine Always had a hard time with them
@SoloCodeNet
@SoloCodeNet 5 лет назад
excellent vidéo ! simple and precise !
@ahmadtakhimi6839
@ahmadtakhimi6839 5 лет назад
Can you please do an example or tutorial for 3d ragdoll ? Thanks
@outhander3941
@outhander3941 Год назад
it works fine when pushing one rigidbody but colliding with multiple bodies results in strange behavior like bodies or character accelerating too fast
@eirikb3463
@eirikb3463 3 года назад
I wish I knew what groups were before I watched this tutorial.
@arlleylp2308
@arlleylp2308 4 года назад
that's all i need, thank you very much
@tato6418
@tato6418 3 года назад
Thanks for this fantastic tip, its a (literal) game changer. I used it on my top down game and it works wonders, but i discovered it doesnt "spin" the object as it normally should, so after some (a ton) trial and error, i came up with this bit of code to solve that: (Just add it after the "apply_central_impulse" bit) var spin if collision.normal.y < 0 and abs(collision.normal.y) > abs(collision.normal.x): spin = -(collision.collider.get_global_position().x - get_global_position().x) elif collision.normal.y > 0 and abs(collision.normal.y) > abs(collision.normal.x): spin = collision.collider.get_global_position().x - get_global_position().x elif collision.normal.x < 0 and abs(collision.normal.x) > abs(collision.normal.y): spin = -(get_global_position().y - collision.collider.get_global_position().y) elif collision.normal.x > 0 and abs(collision.normal.x) > abs(collision.normal.y): spin = get_global_position().y - collision.collider.get_global_position().y collision.collider.apply_torque_impulse(spin) EDIT: Nevermind, this "works" but breaks as soon at the body completes a half rotation, i'll leave it anyways in case someone wants to continue or i come up with a solution
@ali32bit42
@ali32bit42 2 года назад
the code made a mistake here. central impulse is not effective for this problem. use apply_impulse() instead. you can take the exact collision point for the rigid body and kinematic body and use it like this _apply_impulse(collision_location,innertia * collision_normal)
@darkexior
@darkexior 5 лет назад
amazing video, thank you!
@baconator2391
@baconator2391 2 года назад
im having problems in 3d where the rigid body starts to move but then it just stops like it has lots of friction
@hidemat5141
@hidemat5141 5 лет назад
I was just having this issue. Well time post thanks.
@mmorenopampin
@mmorenopampin Год назад
how could we add friction? so that when I stop pushing a box it doesn't keep sliding so much? I'm using godot 3.5 btw
@potatopen5282
@potatopen5282 5 лет назад
Hey man! Love your work! I wanted to ask, can you make a tutorial on how to implement dialogue in godot? How to branch out choices, and how to call a function within the dialogue, you know, stuff like that?
@Aosa_Aosa
@Aosa_Aosa 3 года назад
Great video. Works perfectly. One question I have: how can you get this working for point2d nodes? I'm able to set up point2d nodes and they interact with rigid bodies as expected. By when a kinematic rigid body interacts with them they don't react.
@Sam01951
@Sam01951 4 года назад
Nice tutorial, but my player doesn't move when applying this script.
@Kidscancode
@Kidscancode 4 года назад
Check your code again, you need to find what you did wrong.
@Sam01951
@Sam01951 4 года назад
@@Kidscancode Thanks.
@Yuhara_rev
@Yuhara_rev 4 года назад
Thank you so much, that was very useful
@kirkula
@kirkula 4 года назад
oh my friggin jeeeeeez...I've spent the last few days trying to find out why my space ship will move my darn asteroids around like they're nothing, but everything I tried I couldn't figure out why I wasn't detecting a collision the other way around...all I needed to do was add a ", false" aaarrrgghh!! I'm glad I finally found this, but holy crap that was staring me in the face this WHOLE time too hahaha, I was ike "nahhh, I'll leave the infinite inertia boolean set to false, I don't think THAT'S the problem, it's not even showing a collision!" oh my f'n g....wow...ok...steam let loose....rant over...I'm very thankful I found this video, my google-fu failed me immensely on this one.
@kirkula
@kirkula 4 года назад
oops, "...boolean set to *true" is what I meant to say
@kirkula
@kirkula 4 года назад
oh wow, now looking through the docs I see why I missed it. I'm using move_and_collide, which in the docs doesn't give any info about infinite inertia. I didn't look at the arguments for move_and_slide being I wasn't using that....and THAT'S where infinite inertia is explained in the docs. a "see 'infinite inertia in move_and_slide" would have been nice to see so I didn't miss that...grr
@ryscale4014
@ryscale4014 2 года назад
How does it work with 3D kinematic bodies and vehiclebodies?
@revolentertainment2411
@revolentertainment2411 4 года назад
great tutorial! i have a question tho, when lets say i hit a ball(rigid2d) with my kinematic and the ball bounces and hit me back,my kinematic moves a bit,why is that happen? thank you.
@majorbarnulf2608
@majorbarnulf2608 4 года назад
hey, thanks a lot
@McHumaty
@McHumaty 4 года назад
Very nice!! ...and if I want to pull an object? How could this be done?!
@SimpleTrax
@SimpleTrax 3 года назад
Compared to other engines, this still seem glitchy in my opinion. I love godot, free and easy to use, but its physics gives me headaches sometimes. Better off writing a physics simulation in 2D. I also noticed that when I push one rigidbody and then 2 rigidbodies, their combined mass remains the same as if I moved just one rigidbidy.
@ali32bit42
@ali32bit42 2 года назад
its because the "solution " is not very effective. what he should have done is apply some more code to calculate realistic innertia instead of having a static one. and make sure the kinematic body can also retrive innertia from rigid body objects so it does not stand still when something hits it at a high velocity. also the impulse is applied at the center which is flat out wrong. it should be applied at the collision point not the center of the rigid body object.
@christiansktt6903
@christiansktt6903 2 года назад
​@@ali32bit42 Hi Ali, seems like you know what your taslking about, I see the same glitchy issues and are looking for an example done the right way. I'm not a programmer, so don't know how to program it, but I need it for a game i'm thinking of. Would you be able to help?
@harrylbonyoutube6981
@harrylbonyoutube6981 5 лет назад
These videos have been a great help as I try to learn Godot! I have a question that isn't related to the video however. I'm working on creating a 2D game, but for stylistic purposes, putting it in a 3D environment. I want my character's arm to point at the cursor, but the easy way of doing that in 2D doesn't work in 3D. I've tried to figure it out myself, and it seems the answer has to do with raycasting, and folks have some code snippets I could grab, but I just can't wrap my head around it. Any chance of doing a video on finding the cursor location in a 3D space and getting a 3d object to look at it? Keep up the good work.
@josephastrahan6403
@josephastrahan6403 5 лет назад
I wrote a comment on how to do it in 3D if you want to see.
@harrylbonyoutube6981
@harrylbonyoutube6981 5 лет назад
@@josephastrahan6403 Thanks!
@jvstAsYouAre
@jvstAsYouAre 4 года назад
@KidsCanCode For some reason after some time where I have been pushing around my cube it almost seems "fall into place" so that I can no longer move it around. I'm working in 3D and it is usually when I get the cube right up against a corner or if I jump on it. Any ideas why that would happen?
@DanziG523
@DanziG523 5 лет назад
Thank you!
@vihn78
@vihn78 4 года назад
Hello, nice tutorial. Would you mind getting even more deep on this topic, like for example how to hold a rigid body, making it follow the kinematic body, and then how to hit it, applaying force, like for example a soccer player getting the ball, dribling with it without losing it and then being able to kick the ball in a desired direction?
@Kidscancode
@Kidscancode 4 года назад
This might help you get started: kidscancode.org/godot_recipes/physics/rigidbody_drag_drop/
@ali32bit42
@ali32bit42 2 года назад
i like the tip about infinite inertia but the solution is a bit too basic for more advanced games designs. for more complex movement styles where max velocity can vairy alot between actions it might not work or be really inacccurate, fast moving characters wont have enough force and slow moving ones might have too much. what i would do it keep track of the velocity which is possible by comparing the last locaton with the current location each frame using delta time as the T (you can use the velocity for move_and_slide function too but this might help if you calculate velocity in a strange manner). then use the velocity to calculate a more accurate innertia for the kinematic body which will also use a "mass" number to be more realistic. after that i would not use central impulse to add force to the rigid body and instead apply the impulse at the collision point which is more accurate and will ensure colliding with a corner for example rotates the boxes more accurately . i would also try to take some physics data from the rigid body objects themselves to ensure my kinematic body can also react to colliding with other objects. as sometimes godot does not apply rigid body collisions in an accurate manner which is partially causing the whole collision problem since rigid body objects cant "fight back" the kinematic body. overall the best solution for this problem is a bit more complex but its what you need to do in order to have the most perfect system.
@christiansktt6903
@christiansktt6903 2 года назад
Hi Ali, seems like you know what your taslking about, I see the same issues and are looking for an example done the right way - No glitching. I'm not a programmer, so don't know how to program it, but I need it for a game i'm thinking of. Would you be able to help?
@ali32bit42
@ali32bit42 2 года назад
@@christiansktt6903 hi . i recommand doing some research on the real life physics of inertia and the formulas involved. look for a formula that can convert velocity and mass to inertia for impact. you can use the get_last_slide_collision() function to get data for which objects you have collided with. then you must get the velocity and point of impact for each object that you have collided with and then after that you must get the nodes that you have collided with and store them in an array then use a "for each" loop to quickly check for rigid body objects in the array . then for each rigid body in the collision array you must calculate the correct innertia using the velocity and mass of your kinematic body then send a signal to the rigid body object and trigger their _apply_impulse() function with the force of inertia and location of the impact for the function input. sorry if its confusing . the process is a bit complicated
@dmr12jmy
@dmr12jmy 2 года назад
That's a great comment here. Do you have any suggestions where I can learn about solutions to the rigid bodies "fighting back" the kinematic bodies? I see this issue a lot, especially with solid bodies, which rotate. Thanks
@ali32bit42
@ali32bit42 2 года назад
@@dmr12jmy i have been researching this myself. the subject is a little heavy with math but if you look up something like "rigid body collision response" you will find a bunch of articles that show how to do it . there was also newtons law of restitution which if you understand well you can implement yourself. i dont have the link but a document from chris hecker has more info about it
@beginnereasy
@beginnereasy 2 года назад
Actually like the default physics.. the game should react with objects a little like a game and a little like real life
@macgyver7457
@macgyver7457 5 лет назад
thank you
@efimov90
@efimov90 5 лет назад
Is there some way to detect collision of 2 static bodies? By some function maybe? I try to find something about this for 2 days along, but can't find anything usable.
@Kidscancode
@Kidscancode 5 лет назад
Static bodies by definition don't move, so they can't collide. They don't detect collisions because the purpose of them is to be lightweight, non-moving objects with no functionality other than to provide a body *other* objects can collide with.
@efimov90
@efimov90 5 лет назад
@@Kidscancode sure, in stage of gameplay it's normal, but i think may it be some way to play around this and detect somehow collision of 2 static body or they collision shapes manualy by some function? I don't want they can move, only detects if they intersect each other. Basicaly i trying to make some level generation by placing modelled rooms, but i stucked at moment when they placed in other rooms.
@Kidscancode
@Kidscancode 5 лет назад
@@efimov90 Static bodies don't detect collisions.
@efimov90
@efimov90 5 лет назад
@@Kidscancode sure, but i found solution: there are class "PhysicsDirectSpaceState" with methods collide_shape and intersect_shape which accepts "PhysicsShapeQueryParameters" which accepts shape from CollisionShape (not sure, but only convex). Anyway right now i can't use it, output is different from i expected, so i need to figure out what exact goes wrong. One problem is that it detect collision with own static body, but it's not big problem, second problem is wrong collision detection. I make a test scene where i try to intersect cube and prism, suddenly Query result show collision with cube where i dont expect it, but if move prism away - detection stops (only own Static body left).
@efimov90
@efimov90 5 лет назад
@@Kidscancode i fix a problem with wrong position - i just use get_world at mesh (because i see it earlier somewhere), but needed use just get_world as get_tree - alone
@jared0801
@jared0801 4 года назад
Any idea why my rigidbody2d always falls through tiles with one-way collision?
@MrHarumakiSensei
@MrHarumakiSensei 3 года назад
I changed apply_central_impulse to apply_impulse so my rigidbodies would spin if you hit them on an edge: collision.collider.apply_impulse(collision.position, (-collision.normal * inertia)) ...but I get weird behaviour where SOMETIMES the impulse is applied correctly, but sometimes the impulse is in the opposite direction. I.e. the rigidbody moves back towards the kinematic body that hit it. Edit: it turns out 'sometimes' is whenever a contact is reported as a little red square when 'visible collision shapes' is turned on under the debug menu.
@Gloria-mq3lu
@Gloria-mq3lu 2 года назад
invalid call. nonexistent function 'apply_central_impulse' in base Rigidbody
@ImraneDev
@ImraneDev 2 года назад
thanks
@nicowagner8655
@nicowagner8655 3 года назад
Mine didnt work until i gave the "top_on_slope" an extra false. no idea why but hey.
@ssenna207
@ssenna207 3 года назад
where did u put it?
@chomiyeons
@chomiyeons Год назад
is there anyway for this to happen in 3d? i tried doing what u did in 3d but im having glitches
@winhtetlu4069
@winhtetlu4069 4 года назад
is there any way to make the block to stop rotating?? plz help
@Kidscancode
@Kidscancode 4 года назад
Rigid bodies can be set to "character" mode, which prevents them from rotating.
@winhtetlu4069
@winhtetlu4069 4 года назад
@@Kidscancode thank you sir
@winhtetlu4069
@winhtetlu4069 4 года назад
@@Kidscancode I have tried changing to "character mode" ,but the block move to certain distance when pushed then get stuck at point.
@linasjaniques
@linasjaniques 2 года назад
NICE! 2022 and still helping, but I have a bouncing ball and the faster I am when I hit it, the less it will bounce. Can't figure why
@linasjaniques
@linasjaniques 2 года назад
So... If I'm not jumping and the ball falls on my head, the collision.normal.y returns 1, but if I AM jumping, it returns less than 1... That's why just multiplying it by the inertia, it will return a lower value when there's player movement at the time of the collision.
@Vincent-kl9jy
@Vincent-kl9jy 3 года назад
this was great, but how do you make this work over multiplayer?
@AnKlMa
@AnKlMa Год назад
How can this be solved in Godot 4?
@markolazic6352
@markolazic6352 4 года назад
Great tut, can you give me some advice on doing this in 3d because i still cant jump on object without it slipping through floor??
@Kidscancode
@Kidscancode 4 года назад
It should work the same. Maybe you're applying too much downward force, so the rigid body sees the kinematic as really "heavy". Maybe there's a problem with your collision shapes, or the thickness of your floor. You'll need to experiment on your particular setup.
@markolazic6352
@markolazic6352 4 года назад
@@Kidscancode I was just checking all the things you mentioned and I had another vector for falling and i edited it too, so now it works. Thank you so much! :-)
@upyours2707
@upyours2707 5 лет назад
thanks!
@abhilashpawar1875
@abhilashpawar1875 4 года назад
Hey, my script isn't working I cant push the objects although the script is the same! pls help!
4 года назад
I guess you forgot the add the rigidbody to the a group. If you select the rigidbody than you will find the groups menu in the Node tab. I hope this was your problem.
@OsamaBombLyrics
@OsamaBombLyrics 5 лет назад
Hello, first off this and all the other videos have helped immensely. I am working on a top down game and have put 'false' for the infinite inertia in the move and slide method. My player interaction with the rigid bodies works great except for when I push from the top. When my Player collides with the rigid body from the north side moving down it seems like all these other vectors are being applied. I have gone into project settings and turned gravity off everywhere there is an option too. I would like to understand why this is happening. If anyone can help I would greatly appreciate it.
@OsamaBombLyrics
@OsamaBombLyrics 5 лет назад
Okay so I went into the script for my RigidBody and created the integrate_forces method. From there I just clamped the linear_velocity. After that I just set the mode to Character to keep it simple and my problem seems to be solved.
@sadiewinterlord6908
@sadiewinterlord6908 4 года назад
Help, I get this error: The method "get_input" isn't declared in the current class
@benvella1728
@benvella1728 4 года назад
it's just a function he made containing the usual "if Input.get_action_pressed("game_left") direction = Vector2.LEFT" stuff. He did that to clean up code from user's controls and separate it from physics processes
@Ufol
@Ufol 5 лет назад
The following link doesn't work: "It’s assumed that you have at least some general programming experience. If you’re completely new to programming, click HERE for tips on how to get started."
@cinomontague
@cinomontague 4 года назад
You have comments enabled which means according to RU-vid this is in fact not for kids.
@NgaeGameStudio
@NgaeGameStudio 4 года назад
Thanks
Далее
Godot 3.1: 3D Camera Gimbal
15:55
Просмотров 28 тыс.
Godot Nodes Explained: 2D Joints
11:47
Просмотров 45 тыс.
Только ЕМУ это удалось
01:00
Просмотров 2,9 млн
Godot 3.0: Rigid Bodies
20:54
Просмотров 54 тыс.
Godot Recipe: Drag-select Multiple Units
11:46
Просмотров 16 тыс.
Godot Recipe: 3D KinematicBody: Align with terrain
15:48
How to Code (almost) Any Feature
9:48
Просмотров 692 тыс.
10 Tips For Using The Godot Engine
7:23
Просмотров 26 тыс.
6 Tips to Better Organize your Godot Projects
11:39
Просмотров 135 тыс.
How to Apply Forces to a RigidBody in Godot (2D & 3D)
17:50
Enemy AI Series 1: The State Machine
12:10
Просмотров 53 тыс.
How 2D Fighter Games are Animated
7:13
Просмотров 388 тыс.
Godot's Hidden Level/Map Editor
3:39
Просмотров 139 тыс.