UDN
Search public documentation:

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

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 > User Interfaces & HUDs > Scaleform GFx > How to display something on the HUD when a trigger is touched

How to display something on the HUD when a trigger is touched


Overview


There are a number of ways you could display something on the player's HUD when they touch a trigger in the level. Using Kismet only is one possible approach for example. Another way to approach it would be to create a custom trigger object in UnrealScript (which you can place in the level) that informs Scaleform to do something.

YourTrigger.uc
class MyTrigger extends Trigger
  placeable
  ClassGroup(Common);

event Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal)
{
  local Pawn TouchingPawn;
  local MyPlayerController PC;
  local MyHUD HUD;

  TouchingPawn = Pawn(Other);
  if (TouchingPawn != None)
  {
    PC = MyPlayerController(TouchingPawn.Controller);
    if (PC != None)
    {
      HUD = MyHUD(PC.MyHUD);
      if (HUD != None && HUD.HUDMovie != None)
      {
        HUD.HUDMovie.DoSomething();
      }
    }
  }
}

This will call HUDMovie::DoSomething(), which would allow you to perhaps animate the HUD in a fancy way or to display some text for example.