Unity help with OnTrigger Enter gravity turn off

Hey guys and girls,

Simply enough I’m having a little trouble with this part of a script, as simply enough I don’t quite understand javascript just yet. What i’m trying to do is OnTriggerEnter I want the gravity applied to this object via its rigidbody to be tunred on… however it’s not quite there.

function OnTriggerEnter(otherObject: Collider){
	if(otherObject.gameObject.tag == "switch1"){
	var block1 = GameObject.FindWithTag ("block1");
	block1.attachedRigidbody.useGravity = true;
	}
    }

Any ideas would be lovely.

Thanks!

try getting rid of “attachedRigidbody” and just using “rigidbody”.

EDIT:
and if you’re trying to change the gravity on the object that this script is on, then don’t bother with the “block1” stuff… just use “rigidbody.useGravity”