Wednesday, 27 August 2014

Unity3d - Collision Part 1

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 cube2) 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
Material
Reference 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.
Size
The size of the Collider in the X, Y, Z directions.
Center
The position of the Collider in the object's local space.
Sphere Collider

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

PROPERTIES

Material
Reference 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.
Radius
The size of the Collider.
Center
The 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

Material
Reference to the Physic Material that determines how this Collider interacts with others.
Is Trigger
If enabled, this Collider is used for triggering events, and is ignored by the physics engine.
Radius
The radius of the Collider's local width.
Height
The total height of the Collider.
Direction
The axis of the capsule's lengthwise orientation in the object's local space.
Center
The 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.

PROPERTIES

Material
Reference to the Physic Material that determines how this Collider interacts with others.
Is Trigger
If enabled, this Collider is used for triggering events, and is ignored by the physics engine.
Mesh
Reference to the Mesh to use for collisions.
Smooth Sphere Collisions
When this is enabled, collision mesh normals are smoothed. You should enable this on smooth surfaces eg. rolling terrain without hard edges to make sphere rolling smoother.
Convex
If enabled, this Mesh Collider will collide with other Mesh Colliders. Convex Mesh Colliders are limited to 255 triangles.


No comments:

Post a Comment