I have set up a simple test map consisting of a slab of BSP, a
skylight, a playerstart, a skydome, and a directional light.
I will only be using default editor assets which can be found
in the EditorMeshes and EditorMaterials
packages.
I will be using Movers/Interpactors (the terms are interchangeable)
that are sometimes animated through Matinee. If you need to
learn Matinee, I would recommend Hourences'
Tutorial on them as a starting point.
I added the default mesh cube as a static mesh to the map, converted
it to an interpactor, and then made it very thin. The pivot
is in the center so I will only animate it up and down, or side
to side. A door turning on its hinge requires both a pivot on
one side of it, and some forethought to where the player will
be so as not to squeeze them against a wall.
*Note: Pivots/Origin points on StaticMeshes serve as the 'hinge
points' for interpactors. If you need to create a door, or other
moveable object that revolves, rotates, or swings on an edge,
you'll need to be aware of the mesh's pivot/origin location.
It is impossible to re-assign this pivot permanantly in the
engine. For mesh placement, you can currently temporarily assign
the pivot to a new location, but when you're done, the pivot
will be back at the origin. If you find a mesh that you want
to use as a swinging door, and its pivot is in the center, you
are out of luck. The origin is determined when the mesh is created
in a 3D Modeling application - not in the Unreal Editor.
Shot/Damage Doors: This kind of door is opened
when an interpactor receives damage from being shot. I've set
up a very simple system.
*Note: Using staticmeshes for these can work, but is not reccomended
- especially in an online setting. Interpactors work much more
reliably.
Let's use the 'Cooking' analogy I outlined in the Applications
introduction to set this up:
1) What are we making?
A door that opens when it is shot/damaged.
2) Gather the ingredients:
Mover (door)
Damage Event
Matinee
3) Put it together. In the level, I've created two walls and
placed a thin mover between them.
|
|
On the kismet side of things, I created a 'TakeDamage'
Event based on the mover. I set its DamageThreshhold to 10,
its minimum damage to 5, and its MaxTriggerCount to 0. I hid
the unused connectors on the matinee. So when the door takes
any kind of damage, it will play the matinee and open.
|
|
4) Test it. Go in game and test it out. It worked fine for me.
5) Refine it. First, think about the collison and lighting and
get those fixed. Then consider any potential issues. Do we want
it to do anything else?
If we wanted to add sounds, we could add them through a matine
event track, or through the interpactor itself. Open its properties
and expand down the 'interpactor' section as shown. You would
select the open/close sounds in the generic browser and assign
them to the appropriate fields. Just make sure they sound proper
once they're in - they don't play too long or too short, for
example. These fields might only work with the 'Mover'
event, however, I haven't tested that.
|
|
Is there anything else we want to do? Well, should the door
stay open? Or close after a certain amount of time? Let's close
the door after 5 seconds. I'll add a delay to the system. We'll
connect the completed to the delay, set the delay for 5 seconds,
and connect the out to the 'reverse' of the matinee. I've added
a gate to prevent the damage from firing before the matinee
has ended, but now I need a way to control its opening again.
So I add another delay that's the length of time the matinee
plays, in this case 2 seconds, and add that to the system to
re-open the gate. I'll also hit the 'rewindonplay' checkbox
in the matinee's properties. |
|
Now I'll add sounds to the system via kismet instead of the
interpactor's properties. I've created an open event in the
matinee, and I'll attach the close sound coming off the command
to reverse the matinee. Also, I've targeted the door for the
sounds so the sounds emanate form the door.
|
|
Now, what happens if a player is in the way while the door is
closing? I'll need to use a 'Mover'
event's Actor Hit output to either re-open the door, or kill
the player. I'll choose re-open, but you could easily hook up
a CauseDamage
to the player. However, to I'll also need to create a second,
close matinee for the door and hook the mover event into that
for this system to work properly. Finally, if the player bumps
the door, I'll need to stop the close door sound and play the
re-open sound.
|
|
6) Adjust it for Single/Multiplayer. As you may have read in
the SinglePlayer/Co-op/MultiPlayer
section, there are many considerations to take into account
for whichever system you're setting this up for. The system
as it stands might be ok for single-player and multiplayer both.
But you chould still ask yourself some questions. What happens
if two players are fighting through the door? Actually, it looks
like that might be ok. What if they both shoot the door? Well,
it will open again as long as it receives damage so... that
seems ok. If you want enemy NPCs to open the door, you'll need
to add something that allows AI to shoot at the door. Otherwise,
the system looks pretty complete as is. Unless you want to add
dynamic lights or emitters to the system...
|