Tag Archives: Unity3d learning

Unity about meshcollider collider cannot trigger collision event

Unity cannot collide after adding a mesh collision to an object. It was later found that the properties of the component Is Triggle were ticked off so that normal collisions could occur.


// for the game object, add collision

GameObject blank;

private float moveSpeed = 1.0f;

if (! blank.GetComponent< MeshCollider> ())

{
blank. AddComponent< MeshCollider> (a);
blank. GetComponent< MeshCollider> ().convex = true;

}


// mobile game object

blank.transform.Translate(Vector3.right * Time.deltaTime * speed);

after the normal work.