An Animation Event is a detector that we can use to have something happen, because an animation happened. This is very useful if you want something to happen in game, not because the player directly made it happen, but because of something else that they did.
This tutorial assumes that you are familiar with making basic animations of objects, and uses elements from my tutorial on Interrupting Animations.
For a Video version of this tutorial you can click here.
Let us take a look at my scene below. I've added a "Door" that has an animation that makes it swing open:
I have a PageInfo component and a animation component on it. Nothing else special is required.
What I want to happen is, I want my blue cylinder I made that rises up and down, to have the door suddenly swing open when the cylinder get's half way up.
Now, I could use animations to just have the door swing open at that point, but this is a much simpler way to do it. The game is going to detect when the blue cylinder is half way up and then open the door for me.
So I select my blue cylinder, and I open up the Dope Sheet for it:
Now, what I have done is add a Key Marker to it, right at frame 150 (which is the half way point of the animation). Unlike the start and end markers, I have given this marker a different name:
It is important to do this! If you give the marker the same name as your start and end marker, it will not show up where we need it later! Once you have made this marker, we need to add the detector.
For this I selected one of my region sensors. You do not have to apply it that, you could apply it to the cylinder or anywhere really. But I wanted to keep things together. To add an "Animation Event" component, open up your Component Manager and click on New > Detector > Anim Event:
When I attach it, I then select it and look at the roll out for it:
You will have to pick the animation and object, and once you do so, you will see your markers appear in the Events box. This is why it was important to give your event marker a different name than the start or end markers. If you gave it the same name, it would not show up here. I selected the marker as you can see from the above picture, meaning that point in the animation is when I want the Animation Event Detector to detect.
Now I make a new logic responder. In this one, the detector will be my Animation Event:
And of course the commands for the responder is to open the door.
That is all there is to it to get this started. I'm sure you can imagine all sorts of neat puzzles you could have using this, including multiplayer ones where a 2nd player has to do something to help other players!
The following is a video showing you the end result:
Return To: 3DS Max Plugin Tutorials