UDN
Search public documentation:

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

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 > Static Meshes > Using KActors
UE3 Home > Physics > Using KActors
UE3 Home > Level Designer > Using KActors

Using KActors


Overview


Dynamic elements can bring life to game environments and provide an added aspect of realism for the player. Objects driven by real-time rigid body physics simulations can be added using the KActor. This actor uses a single StaticMesh asset and can be pushed or moved around using forces from weapon fire, special force actors, and even by the player. These are great for adding items such as crates or barrels placed around the map but can also be used for more complex effects like doors that can be pushed open, swinging lights; practically any physics-driven effect.

Placement


KActors are placed in maps using the right-click context menu of the viewports.

ALERT! Note: A StaticMesh asset must have simplified collision geometry in order to be used with a KActor.

Context Menu

  1. In the Content Browser, select the StaticMesh you want to add to the map as a KActor.
    place_select.jpg
  2. Right-click in the viewport where you want to add the mesh and choose Add RigidBody: [MeshAssetPath] from the context menu. The location does not need to be exact. You can always reposition, rotate, scale the mesh afterwards.
    place_context_add.jpg
  3. The StaticMesh has been placed in the map as a KActor, as seen in the Property Window.
    place_complete.jpg

KActor Setup

After placing a KActor in the level, there are properties that may need to be adjusted to get the object to behave properly.

KActor
Damage Applies Impulse
If enabled, damage taken by the KActor will apply an impulse, causing the object to move away from the damage location. The magnitude of the impulse is determined by the DamageType of the damage taken, specifically the KDamageImpulse property.
Wake On Level Start
If enabled, the KActor will be simulated as soon as the level starts. By default, KActors start the level "asleep". This means the physics simulation is not active and they will apear static until they are awakened by some outside force. For certain situations this can be preferable. Consider a pile of crates; unless acted upon by something, the crates would not move and thus have no reason to be simulated immediately when the level begins. However, if you do want your KActors to be active when the level begins, you can enable the Wake On Level Start property.
Limit Max Physics Velocity
If enabled, the velocity of the KActor will be limited according to the Max Physics Volocity proeprty.
Max Physics Volocity
Specifies the maximum velocity the KActor can travel at when Limit Max Physics Velocity is enabled.
Stay Upright Spring
Enable Stay Upright Spring
If enabled, the physics simulation will apply a torque to the KActor's rotation to attempt to keep the it upright, i.e. the local Z-axis of the KActor aligned with the world Z-axis.
Stay Upright Torque Factor
The amount of torque applied in order to keep the KActor upright. This is scaled depending on how far the KActor is from being upright.
Stay Upright Max Torque
The maximum amount of torque to apply in order to keep the KActor upright. This is used to clamp the scaled Stay Upright Torque Factor.

Conversion to/from Other Actors


KActors can be converted to and from certain other types of actors which display a StaticMesh through the right-click context menu of the viewports. This can be handy should you decide that you want a mesh previously placed in the map as a StaticMeshActor or InterpActor to be a KActors, or vice-versa.

Converting to a KActors

  1. In the viewport, select the actor you want to convert to a KActors.
    convert_select.jpg
  2. Right-Click on the actor and choose *Convert > Convert [CurrentActorType] to KActors.
    convert_context.jpg
  3. The actor has been converted to a KActor, as seen in the Property Window.
    convert_complete.jpg

Converting from a KActor

The process of converting from a KActor to another type is the same as the process for converting to a KActor shown above. The types of actors that a KActor can be converted to are listed below:

Material Override


The Material(s) applied to a StaticMesh can be overridden on a per-actor basis. This allows a single StaticMesh asset to be used multiple times in a single map or throughout your game while giving each a unique appearance. The Materials property located in the Rendering category of the StaticMeshComponent of the KActor is an array of Materials that directly maps to those applied to the StaticMesh asset through the Static Mesh Editor. Materials can be assigned to the array manually or they can be applied directly to the mesh in the viewport by dragging and dropping from the Content Browser.

Manual Assignment

  1. In the viewport, select the KActor you want to assign a new Material to and press F4 to open its properties in the Property Window.
    material_properties.jpg
  2. In the Rendering category of the StaticMeshComponent under DynamicSMActor, add a new item to the Materials array by clicking the add_item_button.jpg button. If the StaticMesh has more than one material slot, you may need to add more than one item as the items in the array match the material slots of the StaticMesh.
  3. In the Content Browser, select the Material you want to apply to KActor in the map.
    material_select.jpg
  4. Press the use_selected_button.jpg button for the corresponding item in the Materials array to assign the material. The mesh is now displayed with the Material applied.
    material_complete.jpg

Drag and Drop

  1. In the Content Browser, locate the Material you want to apply to KActor in the map.
    material_select.jpg
  2. Left-Click on the Material in the Content Browser and drag the mouse (while holding the left mouse button down) from the Content Browser to the section of the KActor in the viewport you want to apply the Material to.
    material_drag.jpg
  3. Release the left mouse button to apply the Material. The mesh is now displayed with the Material applied and the Materials array in the Property Window has been updated.
    material_complete.jpg

Physical Material


The physical properties that control how the KActor interacts dynamically with the world come from the PhysicalMaterial applied to the StaticMesh asset. Aspects of the physical simulation such as density, friction, damping, etc. are all configurable through PhysicalMaterials. In addition, PhysicalMaterials provide the ability to specify sounds and particle effects to be played on various collision events, such as impacts and sliding along surfaces.

physmat_effect.jpg

Overriding Physical Materials

This PhysicalMaterial can be overridden on a per-actor basis by assigning a new PhysicalMaterial to the StaticMeshComponent of the KActor.

  1. In the viewport, select the KActor you want to assign a new PhysicalMaterial to and press F4 to open its properties in the Property Window.
    physmat_properties.jpg
  2. In the Content Browser, select the Material you want to apply to KActor in the map.
    physmat_select.jpg
  3. In the Physics category of the StaticMeshComponent under DynamicSMActor, press the use_selected_button.jpg button for the PhysMaterialOverride property to assign the PhysicalMaterial.
    physmat_complete.jpg

Constraints and KActors


KActors can be bound to each other or to the world in order to limit or control how they are able to move through the use of constraints. These actors can limit the movement or rotation of KActors along specific axes to create things like hinges, ball and socket joints, or pulleys, or even drive the movement or rotation to create springs or motors.

See the Physics Constraint Reference for more information and descriptions for all constraint properties.

Constraining a KActor

  1. In the Actor Classes browser, select the type of constraint you wish to use.
    constraint_class.jpg
  2. In the viewport, right-click in the location you want to place the constraint and choose Add [ConstraintType] Here. You can always reposition and rotate the constraint after placing it.
    constraint_add.jpg
  3. Select the constraint and press F4 to view its properties. Press the Lock Selected Actors button to lock the Property Window.
    constraint_lock.jpg
  4. Select the KActor and then press the use_selected_button.jpg button for the ConstraintActor1 property in the RB Constraint Actor category. A red bounding box is displayed around the KActor to show it has been constrained to the ConstraintActor1 property. A blue box would be displayed for an actor constrained to the ConstraintActor2 property.
    constraint_actor.jpg
    The ConstraintActor2 property is left empty. This constrains the KActor to the world at the location of the constraint actor.
  5. Set the desired properties on the constraint. This example has limited the rotation solely to 90 degrees around the twist axis.
    constraint_limit.jpg
  6. Testing the constrained KActor in-game, it now swings when a force is applied.
    constraint.jpg