Colliders
BeginnerDesigner collider component to an entity. Colliders define the shapes and rules of physics objects. There are three types:
- static colliders don’t move (eg walls, floors, heavy objects, etc)
- rigidbodies are moved around by forces such as collision and gravity (eg balls, barrels, etc)
- characters are controlled by user input (ie player characters)You can also:
- shape of collider components
- triggers, and detect when objects pass through them
- constraints
How colliders interact
Colliders interact according to the table below. - “Collisions” refers to collision information and events only. This means the collision is detected in the code, but the objects don’t bump into each other (no dynamic response).
- “Dynamic” means both collision information and events, plus dynamic response (ie the colliders bump into each other instead of passing through).
For example, rigidbody colliders dynamically collide with static colliders (ie bump into them). However, no objects dynamically collide with triggers; collisions are detected in the code, but objects simply pass through.
Show colliders in the Scene Editor
By default, colliders are invisible in the Scene Editor. To show them: - Display gizmo options icon.
- Physics.
The Scene Editor displays collider shapes.
Show colliders at runtime
You can make colliders visible at runtime, which is useful for debugging problems with physics. To do this, use:this.GetSimulation().ColliderShapesRendering = true;Note
Collider shapes for infinite planes are always invisible.Keyboard shortcut
Debug physics shapes script. - Asset View, click Add asset.
- Scripts > Debug physics shapes.
- Reload assemblies and update scripts.
- Debug physics shapes script as a component to an entity in the scene. It doesn’t matter which entity.
Left Shift + Left Ctrl + P, so you can turn it on and off at runtime. You can edit the script to bind a different key combination.
See also
- Collider shapes
- Static colliders
- Rigidbodies
- Kinematic rigidbodies
- Simulation
- Physics tutorials
