- Home /
Triggering a basic animation via Box Collider
I've read about a dozen variations of this question but none seemed to have the solution I'm looking for. I've an animated platform I've created and animated in Max and it plays perfectly in Unity if I check the Play Automatically box.
I've unchecked the play automatically box, created a box I've marked "Is Trigger", made it a child of the platform I want animated but clearly I'm missing something as nothing happens.
What I want to happen is when the player character (3rd person) moves into the Trigger Box, it sets the animation of the platform to play.
Any additional tutorials or script help would be appreciated.
Answer by bwiegele · May 20, 2011 at 12:25 AM
Ok I got it! I had the trigger set to Trigger instead of Animate.
It works, thanks for your help!
Questions are questions, answers are answers... This should be just a vote up and accepting an answer. No "thanks" need to be written, but you could also add a comment to the accepted answer.
Answer by Hordak · May 19, 2011 at 10:47 PM
I just had this problem as a noob my self. Use the activateTrigger script (is in scripts folder) and set it to animation. Pick your source(player) and your target (door). Attach the script to your trigger object and uncheck animate Automatically box.
Works for me.
Answer by bwiegele · May 20, 2011 at 12:20 AM
Hordak,
Thank you, that's what I was missing! I never imported the Standard Assets.
So I've set it up but still no luck. Here's what I've got:
-An object I imported from Max with animation called ElevatorPlat (I've turned off auto play animation) -A trigger box collider named Elevator Trigger with "Is trigger" checked. -I've added the Activate Trigger script to the trigger box. -I've set the Target to ElevatorPlat -I've set the Source to "Human" which is my 3rd person character
I walk into the trigger box and nothing happens.
Answer by Hordak · May 20, 2011 at 09:29 AM
No prob :)
Any chance you figured out a solution to the character falling through the elevator floor as it ascends?
Thank you, Cawas, for going through all my posts and typing the same thing over and over. Once wasn't enough. I clearly didn't understand so luckily you did it twice more. You're very helpful! #sarcasm
Oh, you're very welcome bwiegele. I know the world revolves around you so I did it only for you - and nobody else. ;)