Skip to content

Solver: CCD movement threshold parameter #1040

@MelvMay-Unity

Description

@MelvMay-Unity

I've been looking at dealing with a bunch of feedback regarding the CCD system used in Box2D in Unity. The common concern is the temporary overlap of a handful of key bodies, typically a "player" and maybe another few things. Devs then turn-on bullets expecting that to solve the issue but it obviously won't.

One thing I've been experimenting with is giving devs a per-body collision-threshold that the solver uses rather than its fixed constant of 0.5 when deciding if it should perform CCD or not as seen here. The parameter is specified in the range 0.0 -> 0.5.

Being able to tweak this per-body works really well. Obviously the problem is that if this is reduced too much then CCD is used more often and will become wasteful. I think though that for a few key things in a game, this is quite useful and gives devs more choice.

I added a few images showing the threshold at 0.5 (default) and at 0.1 to show the effect of a unit-circle falling onto a unit-polygon from 1 meter above, under stock gravity with a restitution of 1.

Is this something that'd be worth adding? If so I can quickly put together a PR.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions