Elevator

From RoboBlitz Editor Wiki

Contents

Intial Setup

First, place some kind of flat surface to use as an elevator in your map.

Next you need some way to trigger when the elevator should start moving. I want mine to start moving whenever a BlitzBall rolls ontop of it, so I'm going to place an RTriggerVolume in the space at the bottom of the elevator and use it's RTrigger Event to tell my elevator to start moving. Go ahead and setup the event in Kismet.

Lets keep our Kismet clean, so select the event and right click, add a New Comment. Make the comment name "Elevator". Drag the comment box a little larger so we can stick some actions on there, then the comment box will surround the whole sequence.

A Matinee

In order for the elevator to move we need to set it up with a matinee. A matinee is a pre-scripted set of movements or events, kinda like an animation. Hook a New Matinee up to the elevator starting event's Play tab. Make sure you have the elevator selected when you create the new matinee, that way you don't have to create an object variable for the matinee. Double click the matinee to go into the matinee editor.

While the Matinee editor is open, manipulating objects in the viewports will seem to behave strangely at first. This is because the viewports change the position of objects over time in the matinee, rather than their starting position in the level. If this is confusing, read on, it will become clear soon.

Right click on the gray bar on the left and select Add New Group. Name it "Elevator".

Image:NewMatineeGroup.jpg


Now Right click on the Elevator track and "Add New Movement Track". The dark gray bar running across the right side of the window is a timeline for the matinee. If you're not familiar with interping to keyframes, read this.

I want my elevator to start moving a half second after it's activated, and I want it to arrive at the top after 3 seconds, so I'm going to click around .5 seconds on the numbered part of the timeline and click the keyframe button to add my first keyframe. The keyframe button looks like this:

This first frame should have the elevator in it's down position, which is where I placed it, so I won't make any changes. Next I'm going to place a keyframe around 3 seconds. While the timeline is still at 3 seconds, I'm going to move my elevator up to the top position. You can use the Play, Loop Play, and Stop buttons to view your matinee in the editor. They look like this:

Now I want my elevator to tilt and "dump out" whatever is riding on it, so I'm going to add another keyframe and place the elevator slightly raised and rotated. I don't like the way this looks with the default Curve interpolation, so I'm going to right click on the keyframe before my new keyframe and select Interp Mode->Linear. Which will cause the interpolation to go straight from one keyframe to the other. You might want to use linear interpolation for the whole elevator.

I also want the tilt at the end to move faster than how I originally set it up, so I'm going to right click on my newest keyframe and select Set Time. I'm going to set that time to something a little closer to my previous keyframe, maybe 3.5 seconds.


Now my elevator works pretty well, but it only goes up and stays there. There's an easy way to do this. Add a keyframe at the very end of your matinee, then add a second keyframe immediately before it. Position the elevator in the second to last keyframe next to the elevator in the first keyframe in the matinee. Just before your matinee ends the elevator should jump back to it's starting position. Now in Kismet select the matinee element and check "bRewindOnPlay". This will reset your matinee the next time it plays (that way the elevator will follow it's path correctly, since it stays on the last keyframe after it finishes running the first time.)

Some Notes about the matinee editor

TODO:Scroll bar

Properties

linecurvetension

Kisemet options (properties), PlayRate

If you'd like to adjust the length of your matinee, drag the two halfs of the green triangle on the timeline to the start and end of your matinee. Then select Edit->Stretch Section and enter a value for the length of your matinee. You can also drag the red triangles around to lengthen or shorten your matinee.


A More Evil Example

Image:FancakeVolumes.jpg


When I first encountered this problem I thought it would be simple. I've got a large static mesh of a fancake. It's rotated about 45 degrees, this means that neither it's X nor it's Y axis is lined up with the world axis. Inside of that fancake I'd like an interp object of a rotating fan. Sounds simple enough...

I placed my fan mesh into my level and moved it as close as I could to the center of my fancake mesh. Now I used the rotation widget to line the fan up with the fancake. I just kinda eyed it, it seemed close enough. I created a new matinee and made a movement track for the fan. The first thing I noticed is that when I spun the fan around it's axis it wobbled. I didn't have it exactly lined up with the fancake mesh. To fix this I went into the properties of the fancake and checked it's Yaw (this is the rotation that I applied when I rotated the fancake), then I went to the fan's properties and adjusted it's Yaw to match the fancake.

Image:FancakeAngles.jpg


My next problem was that the rotation handles on the fan were all screwy because I had rotated it and it was no longer aligned with the world coordinates. The solution was in Local Translations.

Now I was finnally ready to setup some keyframes for my animation. My first thought was to set one keyframe at the begining of the matinee and one at the end. I'd spin the fan 360 degrees back to where it started and I'm done! But then I remembered that matinees don't record your translations, they just interpolate between the two keyframes. If I had done that, the fan would have been set to the keyframe 1 position and rotation, then saw that it was already at the keyframe 2 position and rotation and would have just sat still!

What if I did 3 keyframes, one at the start, the second at 180 degrees, and the last back at the start. What would happen then is that the interpolation would begin rotating in one direction, get to the second keyframe, and then begin rotating back in the other direction to get to the third position!

So I'd need 4 keyframes. One at the bottom to make sure the fan rotated all the way around, one on the right side, to make sure the rotation started clockwise. One on the left to make sure the rotation finished clockwise. Then one last keyframe back at the start rotation to finish it up.

So I set it up.... and my fan flipped around like an insane acrobat in zero gravity. It was pitching and rolling and yawing all at once! This is because Euler interpolation (the default method) gets a little fouled up when you mess with it's axises. I won't even pretend to understand the math, but quaternions don't mind if you mess with their axises, unfortunately they don't let you rotate more than 360 degrees. Fortunately we don't want to go more than 360 degrees, so quaternions will work for my purpose. If you'd like to enable quaternion interpolation between keyframes select a movement track and check bUseQuatInterpolation.

Next I set my matinee to bLooping in Kismet and I've got a spinning fan.... a fan that's spinning too fast... to solve this I went back into Kismet and selected the matinee element. I adjusted it's PlayRate variable to slow down the matinee. 0.9 worked well enough.

... Finally.

An Alternate Method

Another way to do this fan example would be to create the rotation matinee while the fan is still aligned to the world axes, that way you can do it with just 2 keys and euler rotation interpolation.

I would set the first keyframe at time = 0, with the fan having a Pitch, Yaw, and Roll of 0. I would then set the last keyframe at time = 1, with 2 of the Pitch, Yaw and Roll variables still at 0, and the third at 360(or -360 for reverse). The one you set to 360 depends on the static mesh, and which way you want it to rotate.

Then be sure to set the keyframes InterpMode to Linear in this case, otherwise the fan would rotate slower near the start and end of the matinee and faster in the middle. Then drag the red triangle for the ending point of the matinee to 1.

For getting precise timing values for keyframes and the start/end times, it can be helpful to turn on the time snap feature(the icon for this looks the same as the keyframe button icon on the toolbar, but it's farther to the right next to a dropdown box of snap settings).

Finally you'd set bLooping to true just like before, and then you can control the rotation speed intuitiutively with the PlayRate variable because of the timings we used for the keyframes. Since we set up the animation to be 1 second for one rotation, if you wanted it to rotate 3 times per second for example, you'd set PlayRate to 3.

Finally close matinee and then rotate the fan to match it's final desired position, such as the orientation of your fancake mesh, and then open up matinee again and hit play to test it. The rotations should remain correct.

Views