I made a little script wich should destroy a cube when walking trough it (with the FPS Controller) but what happens is that it destroys the fpscontroller instead of the cube, anyone got any idea how to solve this?
Here's my script:
var feather : Transform ;
function OnTriggerEnter (feather : Collider) {
Destroy(feather.gameObject);
}
the problem is that you're defining feather as the collider which enters the trigger.
you're saying: the variable "feather" will be the Collider that enters this trigger.
So in your case you could try something like this (untested):
var feather : Transform;
function OnTriggerEnter ()
{
Destroy(feather.gameObject);
}