UDN
Search public documentation:

AttachingActors
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > Level Editing > Attaching Actors
UE3 Home > Level Designer > Attaching Actors

Attaching Actors


Overview


In UE3, it is often desirable to attach objects together in your level. One example might be attaching a light to a moving lift, or a particle emitter to a crane, or a mesh to the bone of some animated character. This document tells you how to set this up in the Unreal Editor.

Dynamic Actors


The first thing to keep in mind is that any actor that is 'static' cannot move in the game, and you should not try to attach these to something else, as it will not work. For example, you shouldn't try and attach a StaticMeshActor to something, but should use a Mover (aka InterpActor) instead. The same goes for lights - use a PointLightMovable instead of a PointLight.

The Base Pointer


Actors have a property called Base, in the Attachment section. This is the Actor that they are 'based' on - or 'attached to'. If you want to attach Actor A to Actor B, the easiest way is the following:

  1. Select A.
  2. Press the 'lock' button on the property window, to keep that window displaying A's properties when you select different Actors.
  3. Select B.
  4. Open up the Attachment section and select A's Base property.
  5. Click the green arrow to assign the currently selected Actor (B) to that property.

Whenever you select an Actor that is based on something else, you should see a green line pointing from the Actor to its Base, and a green box around its Base. This makes it easy to check that everything is set up correctly.

Rigid Bodies


Note that using the Base pointer does not work on Actors that are using PHYS_RigidBody. To connect an Actor that is using physics simulation you will need to use a joint (also known as a 'constraint'). There is more information on this on the VtmConstraints page.

Attaching Actors To Bones


It is also possible to attach an Actor to a specific bone of another Actor's Skeletal Mesh. This can be particularly useful for cinematics - attaching a weapon to an animated characters hand for example. You do this by first setting the Base pointer as explained above. Then you enter the name of the bone that you want to attach to into the BaseBoneName property, also in the Attachment section. When you select the attached Actor, you should see the green line and box as before, but it should be around the specific bone this time. This lets you easily check that you have the bone name correct. You can use the AnimSet Viewer to find the names of bones in a particular Skeletal Mesh - just double-click on it in the Browser.

bShadowParented


Before QA_APPROVED_BUILD_JULY_2008, bShadowParented would only shadow parent to BaseSkelComponent.

As of QA_APPROVED_BUILD_JULY_2008, the bShadowParented flag will shadow parent to BaseSkelComponent if it is valid, otherwise it will cause all shadow casting components of the current actor to shadow parent to the first shadow casting component attached to the Base actor. This causes all the previously mentioned components to cast the same shadow, which is more efficient for rendering and avoids double shadowing where the object shadows overlap.

Attachment Mechanisms


There are two attachment mechanisms in UE3.

SoftAttach

One attachment mechanism is for player Pawns when they are standing on an object. This is the default 'soft' attachment. As the base moves, it calculates the linear motion of the attached Actor each frame, and tries to move it to keep it at the same relative location by applying that motion. This is added to any player movement, so the player can still run around on top of the moving object. Also, if the mover goes under a low ledge, the player will be correctly pushed backwards until he eventually falls off. This can lead to errors slowly accumulating over time though (particularly with rotating Actors), and the attached object may gradually 'drift' from its base.

HardAttach

The other attachment mechanism is known as HardAttach, and guarantees the attachment always has a particular position/rotation relative to its base. Because this does not correctly handle collisions between the attachment and the environment, this can only be used for non-colliding attachments (bBlockActors is FALSE).

The main thing to bear in mind is that if you are seeing attachments slowly becoming detached from their base, ensure the bHardAttach flag is set to TRUE. It defaults to TRUE for most commonly attached Actors (Emitter, PointLightMovable etc).

Matinee


Matinee should correctly handle objects based on other objects. When you keyframe an Actor which is based on something else, the movement information is considered relative to the base. In this way it is easy to set up Actors that move relative to other Actors (eg. doors on a train). Also, attached Actors should update in realtime as you scrub movements and animations in Matinee. The important thing is that you set up your attachments before you start keyframing them using Matinee. Doing this after you have set up a movement track may produce confusing results.