Does Sweeptest actually work?

Hi all,

I’m trying to do something real simple or so I thought.
I wish to control the movement of a cube (box collider) so that it moves kinematically but stops when it collides with a mesh.
I use sweeptest to check ‘ahead’ but either the object intercepts before the collision occurs or a collision is registered when they aren’t colliding. The ‘range’ parameter seems a bit of a magic number.
Any info and what is needed or how sweeptest works internally would be great.


I have struggled with the box/cube collider sweeptest for about 8 hours now.

I was getting what appeared to be “false positives” against a mesh collider (i.e. hits/collisions when I was not expecting them).

After about 3 hours of examination, I hypothesized that the box/cube sweeptest might be using the AABB (i.e. collider.bounds) for the sweep. However, after another 3 hours I disproved my hypothesis. After another 2 hours I just gave up trying to figure out what on earth the box/cube sweeptest was trying to do because I was out of ideas. Would love it if someone could actually describe the behavior accurately (and not just quote the unity reference because it’s flat out wrong for boxes/cubes).

Instead I switched to a bunch of capsule sweeptests that would give me the same coverage and the results so far look good. Depending on the shape you are trying to sweep, a bunch of raycasts might be more appropriate.