changing state of collider

okay I'm going to try this again because I'm still stuck, and unfortunately appending to unityAnswers is almost unreadable.

I am trying to have a game where my foe throws things at my character. When they are in the air, I want my character to be hit and lose a life. However if they are sitting on the ground I want to be able to pick the stuff up.

I start with the objects and add the function below, with the attempt to turn the trigger to false if it hits my false (and floating) ground plane about half a foot above the ground.

I cannot figure out how to change the state of the variables, like the collider's trigger.

function OnTriggerEnter(hit : Collider) {

if (hit.gameObject.tag == "TRIGGER_OFF" )   
    {

    collider.isTrigger=false;

    }

}

Please note. I could use some feedback on what script I'm writing, vague suggestions to try this or that without some pointers on how to go about just leave me scratching my head. I've tried programming this behavior in about 50 different ways so far and cannot get it to work.

thanks

Daev

One approach is to delete the foe-thrown object when it hits the ground and replace it with a throwable object, like this:

var deadReplacement : Rigidbody;

function OnCollisionEnter (collision : Collision) {
    var contact : ContactPoint = collision.contacts[0];
    var rotation = Quaternion.FromToRotation(Vector3.up, contact.normal);

    Destroy(gameObject);  
        if (deadReplacement) {
           var throwableObject : Rigidbody = Instantiate(deadReplacement, transform.position, transform.rotation);
           throwableObject.rigidbody.velocity = rigidbody.velocity;
           throwableObject.angularVelocity = rigidbody.angularVelocity;
        }
}

You then put all the scripts for the throwable object on the replacement, and put the scripts for the foe-thrown object on the original.


EDIT:

The way this works is you have two objects. One object will be deleted when it hits the ground. The other, deadReplacement, will be instantiated in its place. For example, say the original object is a cube. If you put a sphere as deadReplacement, the cube will change into a sphere when it hits the ground, but will maintain the objects speed and such to keep the physics realistic. You could then put a pick-up script on deadReplacement that won't be enabled until it hits the ground. That way, the first object in the air can have a script that will decrease life on contact, but when it hits the ground will be pickup-able.