Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Megisto on March 18, 2013, 07:45:54 PM
-
I'd like to activate the physic of some objects when the player approach to them and deactivate the physic when the player go far.
I tried with a sphere trigger collider that follows the player and two state for the object that must be awaked (sleep > on trigger enter > awake), but it doesn't work. It seems that i can detect when the trigger event enters but i cannot detect when it exits.
Some good advice? thx
-
That's odd.
Make certain that the objects you want to register with the trigger have both a trigger volume and a rigidbody attached.
I can't think of a reason why it wouldn't detect an exit event though, if it successfully detects entry.
You could also try "TriggerStay".
-
Oh, ok. Both of them must have a rigid body attached! Now it works.
Thank you
-
Hi,
stay away from triggerstay :) I am doing poetry now :)
but honestly, this is the biggest source of bad performance you can get with physics. Instead prefer hosting one fsm on the gameobject that listen to enter and exit and maintain a flag.
there is only one case where I have to use trigger stay, it's when you instantiate an object and you can not control where it will be in the world and therefore can be instantiated ALREADY colliding with another object, in that case, you will not get the TriggerEnter call from unity...
bye,
Jean