|
I have a cube, and when a Sphere hits it I want it to get removed, but it isn't working! I've tried it in C# and Java, but neither will work! Here is my java version: function OnTriggerEnter(other : Collider){ Destroy(gameObject); } and here is my C# version: using System.Collections; public class Cube Die : MonoBehaviour { }
(comments are locked)
|
|
I've tested the javascript code and it worked fine. Have you set Is Trigger in the cube collider? Have you attached this script to the cube object? If so, the cube should disappear when some rigidbody or character controller collides with it. One more question: is the sphere a rigidbody or character controller? If it is a character controller, it will not be detected if moved with Translate - only CharacterController's Move or SimpleMove ensures it will be detected. I forgot Is Trigger! Thank you ;)
Jul 22 '11 at 02:13 AM
Lord Moon
(comments are locked)
|
