Weird behavior on 3D rigid bodies with collision layers and masks
Asked Answered
L

4

0

I found a strange behavior in the physics engine of 4.1 (not found in 3.5.x, i.e. in the Bullet engine) .
For example if we have 2 rigid bodies A and B in this configuration:

  • A: collision layer = 1, collision mask = 1
  • B: collision layer = 4, collision mask = 1
    then when the two bodies come into contact the collisions are correctly detected but body A becomes static while B remains dynamic (correctly).
    If, vice versa, the value 4 is also added to the body A's collision mask (i.e. collision mask = 1|4) then both bodies behave correctly in a dynamic way.
    This seems like wrong behavior to me (as said in Bullet, the behavior of bodies is always dynamic).
Ludivinaludlew answered 1/10, 2023 at 12:36 Comment(0)
L
0

Ludivinaludlew In the first case, only body B will make a collision response. Body A won't because B is not in any collision layer the A monitors (determined by the mask). In the second case, both bodies will detect collision with each other and respond.

Litigant answered 1/10, 2023 at 12:43 Comment(0)
L
0

Litigant I attached a little example in 3.5.2 and, as I said, the behaviors is different from 4.1.
In particular, with 3.x (and therefore with Bullet) it seems to me that the behavior is more natural from a more abstract point of view: the interaction (collisions) between body B and any other body A is established by body B itself (i.e. in its collision mask), and furthermore body B wants to interact with body A without a change of the type/nature of A (from dynamic to static, for example).
In addition, by requiring that the collision mask of A also contains body B increases the coupling: that is, if on the one hand body B is "interested" in interacting with A, on the other it does not necessarily mean that A has to know all the types of bodies interested in interacting with him (so as not to change its nature)!

Therefore, if, as it seems to me that you say, this is a design choice of 4.x, I repeat that the mode chosen by Bullet is more linear and fluid.

PS: in projects to orient the camera use mouse+right button and to shoot use space

shooting35.zip
12kB
Ludivinaludlew answered 1/10, 2023 at 15:5 Comment(0)
L
0

Ludivinaludlew I think it's by design. But you can try to report the issue on github and see what the devs have to say about it.

Litigant answered 1/10, 2023 at 15:9 Comment(0)
L
0

Litigant I opened the issue

Ludivinaludlew answered 2/10, 2023 at 10:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.