- Home /
Question by
mahdi68 · Oct 23, 2012 at 08:36 AM ·
androidcollisioncolliderontriggerenter
Problem with OnTriggerEnter
Hi , i have problem with OnTriggerEnter in my project i add two capsule in my project and i set capsule collider for them , i want to one of them move to other one position and when they collide each other both of them be destroyed , i use this code for destroy
void OnTriggerEnter(Collider other)
{
Destroy(gameObject);
}
but its not work ! i set isTrigger true can any one help me thanks
Comment
Are you using a rigidbody? At least one of your colliders should have a rigidbody in order for the OnTriggerEnter to fire.
Answer by Ersin · Oct 23, 2012 at 09:09 AM
First of all you have to add rigidboy on gameobjects.Because trigger actions are about physics.
Your answer