- Home /
Collide with object trigger - why animation only occurs on first encounter with trigger
when I play the lights are active at gameplay, then when the first time I collide with the trigger the animation occurs, then when I exit the trigger the lights turn off and the animation stops(which is what I wanted), but then when I collide a second time the lights still turn on but the animation stops. How do I get the animation to repeat? I have set up an animation controlled by the animator. The first step is idle then when I collide with 'Cylinder' animation occurs, then when I exit it stops as coded, but lights ony turn on in second collision but animation doesnt reoccur?
As I mentioned in your other post, I believe this is due to your paremter being a bool while you are setting it as a trigger, meaning it will never be set to true/false, It is possible that SetTrigger on a bool parameter will automatically set it to true and never back to false, not 100% sure on that but either way you should be calling to SetBool and not SetTrigger, unless you use 2 triggers, one to enter and one to exit.
Answer by stuartmcroberts · Apr 08, 2019 at 05:57 AM
You might want to try resetting your triggers whenever you switch off your lights. Are you also aware that your Cylinder parameter is a bool not a trigger?