player trigger ball falls
I was trying to place a trigger under the sphere so that when my player walks into the trigger, the ball will fall off. How do I write a script to achieve it assuming that we add a Box Collider to the trigger and the trigger is place under the sphere?
Thanks!
Comment
Answer by Guhanesh · Feb 09, 2016 at 10:12 AM
//add RigidBody to ball and set isKinematic,Use Gravity to true;
//add this script to Trigger GameObject
public RigidBody ball;
void OnTriggerEnter(Collider other)
{
ball.isKinematic=false;
}
I created a new script called fall, should I put this script in the void Update(){} or somewhere else? BTW how do I set the wall of the room to be rigid so my player can not walk through it? Thanks a lot.