Unexpected Kinematic behavior

bot2600bot2600 Posts: 3Member
in 3D

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.

Thoughts?

Comments

  • SIsilicon28SIsilicon28 Posts: 714Moderator
    edited June 16

    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: 714Moderator

    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

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file