- Home /
Question by
dalekandjedi · Aug 01, 2013 at 03:44 PM ·
collisiontrigger
How to activate a flipper on trigger
Hello
I have this script
function Update () {
if (Input.GetKey("space")==true) on(); else off();
}
function on(){
hingeJoint.motor.targetVelocity=1000;
}
function off(){
hingeJoint.motor.targetVelocity=-500;
}
function Start ()
{
off();
}
Which i use to activate the flipper with a button on the keyboard for a character but i would like this to activate also when something goes into the trigger
Please help
Comment
Answer by jacobschellenberg · Aug 01, 2013 at 04:12 PM
function OnCollisionEnter(collision : Collision){}
or
function OnTriggerEnter(trigger : Collider){}
Look into the OnCollisionEnter or OnTriggerEnter documention.