Using Mesh Collider.
Objective: Using Mesh Collider.
Why use mesh collider we use this for complex game object to get accurate collision.
Select the game Object and add mesh collider.
You wont able to see the mesh collider because the mesh is exactly like the barrel shape. Now go to the scene view to the last Icon-right, click drop down and check Selection Wire
This is exactly the mesh collider is created according to this vertex or triangle of the mesh.
Important
If we add Rigid body to this barrel, the collision wont work at all.
In order collision to work we need to enable is Kinematic, which mean is we exclude this object from physics engine. The Object wont fall no gravity nothing will work.
But this object will affect other object which have rigid body, so if we create sphere with rigidbody it will collider with it.
If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore. The rigidbody will be under full control of animation or script control by changing transform.position. Kinematic bodies also affect the motion of other rigidbodies through collisions or joints
Get Suleiman Abdullah’s stories in your inbox
Join Medium for free to get updates from this writer.
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Rigidbody-isKinematic.html
MeshCollider by Enabling Convex
When enable this option now rigidbody or physics engine function like normal. This option create complex collider but it reduce over head using cookies options.
See you into the next one.










