Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RigidBody2D isn't detecting every collision #40526

Open
Tracked by #45334
poperigby opened this issue Jul 20, 2020 · 10 comments
Open
Tracked by #45334

RigidBody2D isn't detecting every collision #40526

poperigby opened this issue Jul 20, 2020 · 10 comments

Comments

@poperigby
Copy link

Godot version: v3.2.2

OS/device including version: Arch Linux

Issue description:

I have a RigidBody2D setup, and it supposed to break into smaller pieces when it detects a collision from any other body in the group "bullets". The thing is, it's only detecting some of those collisions. Here's a video of it in action: https://watch.haddock.cc/videos/watch/3448edb0-3ad0-4fe3-ad3d-2293c6fa0ca7

It's pretty unreliable in its detection when you shoot at it from far away, but it becomes pretty reliable when you're at point blank range. Other than that, it seems entirely arbitrary whether or not it will detect collision.

I've tested it on other RigidBody2Ds without the above functionality, and they also aren't reliable in their collision detection.

Steps to reproduce:

  1. Create a RigidBody2D

Minimal reproduction project:

Here's a link to the download of the source code: https://git.haddock.cc/ScrapjackStudios/slayer/src/commit/38c197fa8f4de5027e174c5ba27a3d28a87dff98

I couldn't compress it anymore than 12MB

@Calinou
Copy link
Member

Calinou commented Jul 20, 2020

Does it work better if you increase Physics Fps in the Project Settings or increase the sizes of the bullet collision shapes? If so, this means the lack of collision detection could be due to tunneling (#9071).

@poperigby
Copy link
Author

I cranked the Physics FPS up to 144 and made the collision shape bigger, but it didn't seem to affect it.

@poperigby
Copy link
Author

poperigby commented Jul 22, 2020

@Calinou Something that could be helpful. I think it might be that moving the blocks makes the detect collision. I have a grapple hook that moves objects that it attaches to, and if I hit one of the blocks with the hook and shoot it right after, it will detect the collision from any distance. At first I thought it might have to do with the blocks sleeping, but neither of the sleeping settings were turned on.

Video of it in action: https://watch.haddock.cc/videos/watch/4f26e468-dc84-4846-9079-2612ae9f36b4

@codectile
Copy link

@poperigby is your bullet a kinematic object?

@poperigby
Copy link
Author

Yeah

@codectile
Copy link

Try making your push value a bit higher, maybe 300 or 500. If it doesn't work, I'd suggest you to use RigidBody2D for your bullet.

@poperigby
Copy link
Author

Try making your push value a bit higher, maybe 300 or 500.

That doesn't seem to help

If it doesn't work, I'd suggest you to use RigidBody2D for your bullet.

Why would that help?

@codectile
Copy link

Kinematics bodies are not supposed to be used with objects that are extensively dynamic in nature. It's good for moving characters around, whereas rigid bodies deals with motion, collision and collision responses robustly. With rigid bodies, all you have to do is set your bullet's velocity in direction of the destruction blocks and on collision just subdivide, and all the motion related stuff will be handled internally by godot.

@poperigby
Copy link
Author

That fixed the issue, but I still think it's a problem that rigid bodies aren't detecting kinematic bodies.

@Kylogias
Copy link

Kylogias commented Sep 6, 2020

That fixed the issue, but I still think it's a problem that rigid bodies aren't detecting kinematic bodies.

In the move_and_slide method (which you should be using), set infinite inertia to false, that'll make them collide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants