Skip to content

Default collision group of -1 is problematic #946

@nvtw

Description

@nvtw

builder.py and import_usd.py set the collision_group to -1 by default (if no other group is specified). While this seems to work somehow when the explicit collision pair list is precomputed, it contradicts our test_group_pair which says "Negative values indicate groups that collide with everything except their negative counterpart". So let's say no collision groups are specified, so everything becomes collision_Group -1 assigned. When the nxn broad phase is used that calls test_group_pair, nothing will collide with each other. This does not sound like the intended default behavior.

@wp.func
def test_group_pair(group_a: int, group_b: int) -> bool:
    """Test if two collision groups should interact.

    Args:
        group_a: First collision group ID. Positive values indicate groups that only collide with themselves (and with negative groups).
                Negative values indicate groups that collide with everything except their negative counterpart.
                Zero indicates no collisions.
        group_b: Second collision group ID. Same meaning as group_a.

    Returns:
        bool: True if the groups should collide, False if they should not.
    """
    if group_a == 0 or group_b == 0:
        return False
    if group_a > 0:
        return group_a == group_b or group_b < 0
    if group_a < 0:
        return group_a != group_b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Info

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions