- Home /
Trigger with Gravity + Collision
Is there a way to do this? Basically I want a trigger with gravity on it, to fall to the ground's rigidbody, then stop. Is this possible? At the moment the trigger just falls through the ground if I leave gravity on it, so I switched it to isKinematic and it semi-works, but obviously doesn't fall to the ground. So if there isn't a way to get a trigger to fall to the ground and stop, is there a way to make an isKinematic object fall to the ground?
Answer by Koder · Apr 03, 2011 at 02:15 AM
So yeah, I just left the object with gravity on and isKinematic to false when it's created, and then I wrote this code, and it works.
function OnTriggerEnter( other : Collider ) { print('trigger enter');
this.gameObject.rigidbody.isKinematic = true; print( this.gameObject + ' triggered by ' + other ); / if ( other.gameObject.tag == "Player" ) { Destroy( gameObject ); print( 'Destroyed' ); } else { Debug.Log( 'Cannot be destroyed by this object' ); } / }
The problem is that if it collide with anther object it stop falling .. :(