why does a collider with 0 scale still take collisions?

I assumed when I scale something to 0, the collider won’t be colliding with things, but that’s not the case. Why is that?

Because it’s still something that exists as a point in 3D space.

2 Likes

Because a body with size 0 will still be a point in space. While a point has no volume, it is reasonable to expect it to be impassable.

If you want to disable collision, disable the collider. Also, do not “assume”, read the docs. If the docs do not say “size zero colliders won’t collide”, then no such feature exists.

1 Like

It’s a perfectly good question, and intuitively I can see why you’d expect something scaled to nothing to not collide. It’s not really nothing, though.

Setting scale to zero effectively multiplies the local position of every vertex (or the size of every primitive) by zero. This doesn’t stop them from existing, it just puts them all in the same spot. That doesn’t change the outcome of the math that checks intersections. It just makes one body equivalent to a point.

It’s perfectly valid, and common, to check collisions between an object and a point.

Even if it wasn’t, as a programmer I would expect a zero-scaled collider to still collide with things, for a few reasons. I don’t expect the physics engine to be checking if, say, vertices in a mesh collider are in the same spot and then behaving differently, because that would both incur a computational cost and make behaviour less consistent. There may be valid reasons to scale something to 0 and still check collisions, or for an object to just legitimately be tiny in some cases, and this helps 0 be consistent with other cases.

In other words, while it may be initially counter-intuitive for something which has disappeared to still be solid, it saves a bunch of work addressing edge cases which would otherwise exist, while adding trivial requirements (changing one variable) to address the opposite behaviour where it’s desired.

4 Likes