- Home /
collision between two gameobjects not working
I have a magic effect that i am shooting at an enemy gameobject. The enemy has a capsule collider on it, set to is trigger. The magic effect has a sphere collider, not set to is trigger. The enemy has a rigidbody, which is kinematic. I simply want to recognise when the magic effect hits the enemy, so the enemy can ‘die’. Neither oncollisionenter nor ontriggerenter do anything, regardless of who is set to is trigger and who isn’t. How can I fix this? Thanks.
I should add that I'm moving the magic effect using transform.Translate.
Sorry I was just being lazy when I typed the above question... I did use OnCollisionEnter and OnTriggerEnter.
$$anonymous$$gest you post your actual code then. Things like correct captitalisation matter ;)
Answer by ashleyjlive · Jul 10, 2014 at 06:36 AM
Hi,
transform.Translate has no collision detection. To have collision detection you must use physics-based coding to make it work. Think translate as if it is just teleporting the object in small increments. Please refer to the link below and watch all the videos to get an idea of collision detection.
https://unity3d.com/learn/tutorials/modules/beginner/physics
Your answer