Pages

Sunday, June 26, 2011

Basics Of Collision and Collider

Colliders :

Colliders are another kind of component that must be added alongside the Rigidbody in order to allow collisions to occur. If two Rigidbodies bump into each other, the physics engine will not calculate a collision unless both objects also have a Collider attached. Collider-less Rigidbodies will simply pass through each other during physics simulation.

Add a Collider with the Component->Physics menu. View the Component Reference page of any individual Collider for more specific information: 

Types Of Colliders :

1) Box Collider - primitive shape of a cube
2) Sphere Collider - primitive shape of a sphere
3) Capsule Collider - primitive shape of a capsule
4) Mesh Collider - creates a collider from the object's mesh, cannot collide with another Mesh Collider
5) Wheel Collider - specifically for creating cars or other moving vehicles

Box Collider

The Box Collider is a basic cube-shaped collision primitive.


Properties



MaterialReference to the Physic Material that determines how this Collider interacts with others.
IsTrigger If enabled, this Collider is used for triggering events, and is ignored by the physics engine.
SizeThe size of the Collider in the X, Y, Z directions.
CenterThe position of the Collider in the object's local space.

Sphere Collider

The Sphere Collider is a basic sphere-shaped collision primitive.



Properties



MaterialReference to the Physic Material that determines how this Collider interacts with others.
IsTriggerIf enabled, this Collider is used for triggering events, and is ignored by the physics engine.
RadiusThe size of the Collider.
CenterThe position of the Collider in the object's local space.

Capsule Collider

The Capsule Collider is made of two half-spheres joined together by a cylinder. It is the same shape as the Capsule primitive.


Properties



MaterialReference to the Physic Material that determines how this Collider interacts with others.
Is TriggerIf enabled, this Collider is used for triggering events, and is ignored by the physics engine.
RadiusThe radius of the Collider's local width.
HeightThe total height of the Collider.
DirectionThe axis of the capsule's lengthwise orientation in the object's local space.
CenterThe position of the Collider in the object's local space

Mesh Collider

The Mesh Collider takes a Mesh Asset and builds its Collider based on that mesh. It is far more accurate for collision detection than using primitives for complicated meshes. Mesh Colliders that are marked as Convex can collide with other Mesh Colliders.