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

Kinematic body (3d) not using layer/mask correctly #7227

Closed
sketchyfun opened this issue Dec 2, 2016 · 17 comments
Closed

Kinematic body (3d) not using layer/mask correctly #7227

sketchyfun opened this issue Dec 2, 2016 · 17 comments
Assignees
Milestone

Comments

@sketchyfun
Copy link
Contributor

Operating system or device - Godot version:
Windows 7, custom build from November

Issue description (what happened, and what was expected):

My understanding is that a physics object that has it's layer set to 1, and it's mask set to 2 will only collide with an object that has it's own layer set to 2

In the demo project I've attached, both kinematic bodies have their layers set to 1 and their masks set to 2. As far as I'm aware, this should mean that the two bodies shouldn't collide, yet they both stop when they reach each other.

Conversely, if you set the first objects layer to 1 and it's mask to 2, and the other objects layer to 2 and mask to 1, they should technically collide with each other, but instead they pass straight through.

Wondering if it was related to this issue? #872

Steps to reproduce:

Download and run the attached project. The first scenario I've described is already set up to run, but you'll have to manually edit the two bodies to test the second scenario I mentioned.

Link to minimal example project (optional but very welcome):

https://dl.dropboxusercontent.com/u/3292249/kinematic3d_bug.zip

@bojidar-bg
Copy link
Contributor

bojidar-bg commented Dec 2, 2016

Can you confirm that the same thing works fine for KinematicBody2D? (if it is, then I introduced this bug... ops)

@sketchyfun
Copy link
Contributor Author

Just tested it with KinematicBody2D and it works correctly

@eon-s
Copy link
Contributor

eon-s commented Dec 2, 2016

The issue is on 2.1.1 too (KinematicBody against kinematic or rigid on any mode), happens when using move against anything on the same layer.

Maybe move or the server is checking layer instead of mask because it also pushes rigids on other layers.

@bojidar-bg
Copy link
Contributor

Wait, you mean that Rigid-Rigid works fine, right? 😃

If so, that would limit the bug to the move function...

@eon-s
Copy link
Contributor

eon-s commented Dec 2, 2016

@bojidar-bg Rigid moving (impulse) against kinematic or rigid works fine, Kinematic moving (move) against rigid collides (same layer, any mode) or pushes it (different layer, rigid mode).

So, yes, probably move is the first place to look (but all the KinematicBody code looks old compared to the 2D one).

@sketchyfun
Copy link
Contributor Author

I'm wondering if this ever worked for KinematicBody 3d? Looking at the code, I can't see it making any use of the collision mask in the move function, just the body's layer

@Muzz
Copy link

Muzz commented Dec 5, 2016

Ah this explains some behaviour i saw, this is a thing that would be really good to have fixed!

@eon-s
Copy link
Contributor

eon-s commented Jul 28, 2017

Move is broken on KinematicBody on Godot 3 alpha too, but now it seems to be inverted the layer-mask check (the moving body checks for masks on its layers instead of other layers on its mask).

@kubecz3k
Copy link
Contributor

kubecz3k commented Nov 5, 2017

This should be fixed now, would be nice if someone could check (#12641)

@eon-s
Copy link
Contributor

eon-s commented Nov 5, 2017

Issue persist with Bullet cc @AndreaCatania

@eon-s
Copy link
Contributor

eon-s commented Nov 5, 2017

To resume, using bullet:
Kinematic on layer 2, mask 1, using move and slide:

  • Collides with anything on layer 2 (should ignore)
  • Collides with anything on mask 1 (should ignore)

@kubecz3k
Copy link
Contributor

I can see dropbox link with reproduction is not working anymore. @sketchyfun could you reupload?
Also tip for the future, you can upload directly on github by drag and dropping zip to the browser.

@sketchyfun
Copy link
Contributor Author

I haven't checked if it still works but here's the link https://www.dropbox.com/s/dwp6qx1d64x8t7t/kinematic3d_bug.zip?dl=0

@AndreaCatania
Copy link
Contributor

@sketchyfun this project is not for godot 3

@AndreaCatania
Copy link
Contributor

AndreaCatania commented Nov 22, 2017

I've checked it with either Godot and Bullet physics and it works correctly.

Check it again and close the issue if it's fine please

@sketchyfun
Copy link
Contributor Author

sketchyfun commented Nov 22, 2017

Okay, so I've just recreated the project in 3.0 and I can't reproduce my original issues, so it looks like this is
no longer a problem.

I've uploaded the project just in case anyone else wants to try it, but it seems to be working now.

kinematic_bug.zip

@sketchyfun
Copy link
Contributor Author

I'm going to close this as it seems to be fixed, thanks @AndreaCatania !

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

8 participants