This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Unexpected Kinematic behavior

bot2600bot2600 Posts: 3Member

I am relatively new so I am going to try to explain this as best I can, please excuse my ignorance :)

I have two kinematicbody objects in my scene, enemy, who moves horizontally and bullet that moves vertically.

I move both with move_and_slide() and check their collision in _physics_process(delta) and things mostly work as expected, when the bullet hits the enemy, I basically call queue_free on both and poof away they go.

The odd thing I am seeing is if the bullet is beside the enemy, even though the enemy is moving into the side of the bullet instead of getting a collision on either object, the enemy gets blocked, so its stopped in its tracks for a second until the bullet goes past it and then it starts moving again.

From the docs I chose kinematicbody because they aren't affected by physics, but that seems to not be the case here.



  • SIsilicon28SIsilicon28 Posts: 693Moderator
    edited June 2020

    This would actually be expected behaviour. Since you're moving the bodies with move_and_slide, collision automatically gets handled by sliding the bodies across other collision objects. They aren't affected by physics engine directly like with rigid bodies, but collisions still get handled anyway when you use either move_and_collide or move_and_slide. If you want collision detection, but no collision response, then an Area2D node would be a better choice.

  • SIsilicon28SIsilicon28 Posts: 693Moderator

    By the way, your post got stuck in the moderation queue. Make sure that you have verified your email address.

  • bot2600bot2600 Posts: 3Member

    Thanks for the clear explanation, I'll change that then. Godot is very different in some unexpected ways but I am definitely enjoying it so far! As for confirming my email, I have now, the original request (and new one) went to my spam folder so I didn't see them.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.