I’m really new at scripting so be nice. I’m trying to get a “hand” to grab (go kinematic) when I press the space bar. I only want it to do so if it’s in the collider “ground”. I’m got it to work when not using colliders so something must be wrong with my script. this is the script I’m using. Second one is the one that’s working, but that “grabs” anywhere which I don’t want to do.
function Update() {}
function OnTriggerEnter (other : Collider){
if (other.gameObject.tag == "ground")
{
if (Input.GetKey(KeyCode.Space))
{rigidbody.isKinematic = true;}
}
else
{rigidbody.isKinematic = false;}
}
function Update() {
if(Input.GetKey(KeyCode.Space))
{rigidbody.isKinematic = true;}
else
{rigidbody.isKinematic = false;}
}