Socram's Barge Door Tutorial
Here is a somewhat thorough tutorial on
setting up a functioning Barge Door (you know those red doors you had to kick, punch,
etc to get past) similarly to how Dice did it. There is most likely other ways to do,
possibly better or whatever, but this is just one way. Also this will only cover the
door getting hit and then staying open. There is more you can do with it, such as
automatically closing the door after the player is through or resetting the door for
checkpoints, but those won't be covered. It is recommended that you have already read
Blizzard's basic time trial tutorial, as well as my basic volumes tutorial before doing
this. Also you should have a fairly decent understanding of the basics (BSP, widgets, all
that jazz).
Also this tutorial involves kismet and matinee,
and while I will go through all the steps, an understanding of these two components
would help. Let's begin!
1) Make an island of BSP, whatever size you want really, as long as there is room for a door and for you to walk around and hit it. Put a sky dome around it too if you know how, it will make things easier when testing and such. Light it up too, nice and bright.
2) Place an S_Door_ResidentialBarge_01 as an InterpActor, it is in the P_Generic package. There is other barge doors available with little aesthetic differences. There is also a few prefabs in this package that include the door placed correctly within their frames, but for this example we don't need that.
3) Now comes some less obvious stuff. The way Dice sets up it's barge doors, a different, less complex static mesh is used to detect the hit. This mesh is hidden
during gameplay (which is why you never see it). The static mesh you choose doesn't matter too much as long as it is low poly and cubic in shape. I will be using the
S_CableSystem_02d static mesh, also within the P_generic package. Scale it to fit the shape of the door more or less. It doesn't quite need to fit exactly, especially
hieght wise, since the bulk of the punches/kicks with be near the middle. You do need to make sure it is thicker than the door, so the door doesn't block the player from hitting
the detection mesh. Set it up something like the following: By moving the pivot to the middle of the mesh (Right Click>Pivot>Move Here) I was able to get the mesh to how I wanted it pretty quickly. 4) Before we forget, open up the properties for the detection mesh and and under the the display tab check bHidden on. You will still see it in the editor so don't worry.
Before we start kismet, select both the Barge Door and the detection mesh and convert them to InterpActor (Right Click> Convert> ... to Mover). This will allow us to animate the door and make sure damage detection is working correctly. They will both turn black, this is normal. 5) If you know the basics of Kismet skip to step 6. For those who don't know, Kismet is a system within unreal that allows you to control various events throughout your map. It works like a flow chart, with various condition and events being linked through a system of inputs and outputs. There are some pretty extensive tutorials on the web, as well as a better explanation of it. However this tutorial is not a complete coverage of Kismet, only a specific example. Here are some basic things to know: 6) If you know the basics of Matinee skip to step 7. For those who don't know, Matinee is a system within unreal that the timing of animations, sounds, camera movement, etc within a set time. I'm not very good with Matinee so you might be better off looking up a tutorial elsewhere for a basic look at it. However I will cover what is necessary for this tutorial. To add a matinee sequence to Kismet right click within the Kismet work area and click on New Matinee. To edit this sequence double click it, which will open up the Matinee Editor. Some basics: 7) First we want to get the actual animation of the door out of the way, so in order to do that lets make a new matinee in Kismet (Right Click> New Matinee). Double click it to open Matinee editor. Select the door static mesh in the editor. Right click in the middle section of the Matinee editor in the area beneath All/Cameras/Skeletal Meshes and go to Add New Skeletal Mesh Group. 8) Call it Barge Door, or some variation of that. You'll see you get a movement and animation track for the object you had selected. Click in the track area to move it around, and see the first keyed point, the red arrow. This is the starting position of the animation and by default is whatever position your door was in to begin with. Press the play button and notice... nothing happens. We need another keyed frame. Move the timeline marker to about the half second point and let go. Now go back to the editor and rotate the door to however far you want (this will depend on the level). For now I will just do 90 degrees or so. Then go to the top left of the matinee editor and click the add key button (square with two lines coming out). If everything worked correctly another red point should have showed up where your timeline marker is. Now test it out, drag the marker back to the beginning and press play.... did it work? I hope so. If not check through the steps and make sure you didn't skip over anything. You may realize that .5 seconds is a little slow for the door being slammed open. To fix this, hold ctrl and click the point and drag it left towards more like .25 seconds. This will give it less time to travel the same distance and in turn make the animation faster. 9) You're done with matinee for the rest of the tutorial! The rest is just kismet stuffs. Close Matinee and go back to Kismet. You'll see the Matinee Kismet component as well as a connection from two circles. Circles are variable in kismet. The left circle is simple the matinee data (length of the matinee, keyed points, etc) and the right circle is the InterpActor that is your door. Now lets find a way to trigger this animation in game. Select your detection mesh in the perspective view and then right click in the kismet work area to add it as a take damage event (Right Click> New event using InterpActor_x> Take Damage). You'll see a differently shaped Kismet component pop up, an event. Click this and look at the properties. We only need to change one property from its default, DamageThreshold. This is the amount of damage that needs to be dealt before the event is triggered. Change it from 100 to 1. Now connect the out of the Take Damage to the Play of the Matinee. Test it, and cross you fingers! 10) Didn't work huh? Some more things need to be done first. First check the collision properties for both the door and the detection mesh, make sure both are set to BlockAll (Properties> Collision Tab> CollisionType> COLLIDE_BlockAll). Then for the detection mesh go to the interaction tab under its properties and set bInteractable to true. This will allow Faith to punch, kick, etc like you are used to seeing in game. Also, to fix the lack of lighting on them, go to Properties>DynamicSMActor>LightEnvirontment>LightEnvironmentComponent and set bEnabled to true. This may create other lighting problems but for now t his is the only solution I know of, contact me or Blizz with a solution if you know of one. Now test! 11) Did it work? Should've worked pretty well... however you may have noticed (or maybe not) that you still do the barge kick or punch even though the door is open. This is because the hidden object is still there, accepting your interaction. To fix this we're going to do some more kismet. In the kismet window add a Change Collision action (Right Click>New Action>Actor>Change Collision). Under the properties of this action, set the collision type to Collide_NoCollision. We are still missing something, the actual target of the collision change. Select the detection mesh in the perspective view and place it as a variable in Kismet (Right Click> Add New Var Object Using InterpActor_x). Now link the target of the Change Collision to the circle. 12) Somethings missing.... sound. Almost done guys hold on. Add one more kismet action, a Play Sound action (Right Click>New Action> Sound> Play Sound). Link the out of the Take Damage to the play of the Play Sound. Then in the properties of the Play Sound, set the Play Sound to: SoundCue'A_Props_Interactive.Doors.Door_Barge'
Or find it in the Generic Browser and click the Use Current Selection in Browser button. Then link the target of the play sound to the InterpActor that is already linked to the change collision. This is where the sound originates from. Well thats just about it... that took a while to write and probably a while to get through. Hope you understood it all and learned a lot! Good luck! Here is an example of another more complicated Barge Door, just for reference... :) -Socram