Hi Guys,
I just downloaded Unity3D and i’m working on my first tiny project.
I’m trying to create a small pacman game and i created a Sphere that i can move around, and now i want it to eat some cheese.
I’ve created a function that randomly places Capsules (Instaces of an object) around my map, and i want to destroy these when my Sphere touches them.
So far i have this script on my Sphere object:
var speed = 5.0;
function Update () {
var x = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
var z = Input.GetAxis("Vertical") * Time.deltaTime * speed;
transform.Translate(x, 0, z);
}
function OnTriggerEnter (other : Collider) {
print("Contact");
Destroy(other.gameObject);
}
Both my Sphere and the Capsules have their Collider set to “Is Trigger”, but it never seems to happen.
Am i doing something wrong?
Regards
Martin