Skip to main content

Looks like a collider was scaled

Test first!
It be that your particular instance of scaled colliders won't suffer from any performance drawbacks as Luna does its best to work around such situations in the most effective way.


Looks like a collider was scaled, this might affect performance.


Most rigidbody physics engines (Luna's Physics engine being no exception) don't really have a notion of scale under the hood. The engines operate using objects' positions and rotations, and introducing scale (either directly or indirectly, via parent objects) forces the physics adapters to perform unnecessary calculations. For instance, scaling a sphere collider would simply report amended sphere radius to the physics engine, which is going to be computed as original radius times maximum scale factor. As you can image, non-uniform scale would produce weird results as well: sphere colliders, for instance, are always spheres and never get extruded in any direction. Things are even worse with mesh colliders: it is required to duplicate and scale the whole mesh of the collider, as physics engines consider meshes as either point clouds or a set of triangles and there is simply no way to notify the physics engine that a particular mesh should actually be processed as if it twice as big.


Low / Medium

Steps to fix#

It is best to avoid scaling game objects with colliders attached. Primitive colliders have properties that define their bounds anyway, and mesh colliders are working best when the underlying mesh is baked with required scale.