4.0 Triggers

A trigger is basically an actor that can receive and pass events. There are many different types of triggers, but in general they all have three main properties: Event, Tag, and TriggerAction.

Tag identifies this object and allows it to be referenced in the Event property of triggers. Event references the Tags of other objects and determines which objects this trigger will affect. TriggerAction defines the parameter that will be passed to the event receiver (the object referenced in this trigger’s Event property).

In Figure 21, the trigger with Event “auditorium_doors_2” will invoke the mover with tag matching “auditorium_doors_2”. In this manner whenever the trigger is tripped it will result in the mover being invoked likely causing a door to be opened.

It is important to note that Tags and Events do not need to be unique. One trigger can have an Event property value which matches the Tag property value of a number of other objects. As a result, a single trigger can act upon multiple objects. Similarly, multiple triggers can have the same Event property value which matches the Tag property value of a single object. As a result, multiple triggers can act upon the same object. Finally, many to many relationships are possible.

4.2 LookAndUseTrigger

The Look and Use Trigger is a powerful new trigger type added as part of the web.alive product. Its main purpose is to facilitate the realization of buttons with in the 3D environment which the user can directly invoke by clicking on. The Look and Use Trigger’s collision area is treated as a clickable area. When a user places their cursor over the collision area of the Look and Use Trigger they may click to fire the trigger.

The Look and Use Trigger is usually paired with some visual representation of a button in order to provide proper affordance to the user that interaction is possible. Likewise, by default the user’s cursor is changed when positioned over a Look and Use Trigger to further aid the user in discovering that interaction is possible.

Setting up a LookAndUse Trigger

You’ll frequently be using LookAndUse Triggers to allow users to interact with another actor. To do this, open the Actor Browser in the web.alive Editor, navigate to Triggers, select the LookAndUse trigger and place it in the level by right-clicking somewhere in your map and selecting Add LookAndUseTrigger Here. Open the trigger’s properties -> Events -> Event and type in the Tag of the object you’d like to trigger.

By default, LookAndUse triggers are invisible to users and use the default engine graphic. To make the trigger visible, go to properties -> Advanced -> bHidden and set it to false. To give the trigger a graphic, go to properties -> Display -> Texture and add a texture.

Otherwise, you can represent the trigger by overlapping its collision area with a static mesh or texture as shown in Figure 24.

You can modify the clickable area of the LookAndUse trigger by opening properties -> Collision -> CollisionHeight and properties -> Collision -> CollisionRadius and modifying the values. Normally the collision radius is invisible, but you can view it by right-clicking on the top of the view pane and selecting Actors -> Radii View as shown in Figure 25.

There are a number of properties specific to the LookAndUseTrigger which can be configured to customize the LookAndUseTrigger’s behaviour. Some of those properties are described in the table below.

LookAndUseTrigger Properties

Property Name             Default Value                       Description
-------------             -------------                       -----------
CustomCursorTexture       None                                Used to specify a custom cursor texture to be displayed when the user’s mouse is over the LookAndUseTrigger and they are within range.  This functionality can be used to present users with an information popup whenever the user’s mouse is over the LookAndUseTrigger.
CustomCursorOffsetX       -1.0                                The X offset from the center of the screen at which the cursor should be drawn.  A negative value indicates that the cursor should be centered on the screen.  A value of 0 indicates that the left edge of the texture should be at the center of the screen.  A value equal to the width of the texture indicates that the right edge of the texture should be at the center of the screen.
CustomCursorOffsetY       -1.0                                The Y offset from the center of the screen at which the cursor should be drawn.  A negative value indicates that the cursor should be centered on the screen.  A value of 0 indicates that the top edge of the texture should be at the center of the screen.  A value equal to the height of the texture indicates that the bottom edge of the texture should be at the center of the screen.
enableAuditLog            True                                Indicates whether or not to audit log the event of a user invoking this trigger.
Range                     500                                 The range in unreal units within which the LookAndUseTrigger can be clicked.
SuppressOutOfRangeCursor  False                               Indicates if the OutOfRangeCursor should be suppressed.
TriggerSound              Sound‘CSVariousSound.ClickSound’    The sound to play when the LookAndUseTrigger is clicked.
TriggerSoundAttenuate     True                                Indicates if the TriggerSound should attenuate.
TriggerSoundNoOverride    False                               Indicates if this sound be overridden by another sound.
TriggerSoundPitch         1.0                                 Possible values between 0.5 and 2.0.  At 0.5 the sound is played at half speed and at 2.0 the sound will be played at twice the speed.
TriggerSoundRadius        5.0                                 Radius within which the sound is played at full volume
TriggerSoundSlot          ESoundSlot.SLOT_None                The slot to play the sound in. 
TriggerSoundVolume        1.0                                 Volume percentage expressed as a value from 0.0 to 1.0 where 0.0 is silent, 0.5 is half volume, and 1.0 is full volume.  You cannot make a sound louder, only softer.
PermittedGroups           Empty                               The list of group names that should have access to invoke this access controlled LookAndUseTrigger. (Empty indicates everyone has access to invoke this trigger) See the notes at the end of section 5.2.4 for the necessary syntax.
NoAccessCursorTexture     Texture’WebAliveGUI.NoAccessCursor’ The texture to display when the user’s cursor is over this LookAndUseTrigger and the user does not have access to use this trigger. 
NoAccessCursorOffsetX     10.0                                (corresponds to NoAccessCursorTexture) The X offset from the center of the screen at which the no access cursor should be drawn.  A negative value indicates that the cursor should be centered on the screen.  A value of 0 indicates that the left edge of the texture should be at the center of the screen.  A value equal to the width of the texture indicates that the right edge of the texture should be at the center of the screen.
NoAccessCursorOffsetY     10.0                                (corresponds to NoAccessCursorTexture) The Y offset from the center of the screen at which the no access cursor should be drawn.  A negative value indicates that the cursor should be centered on the screen.  A value of 0 indicates that the top edge of the texture should be at the center of the screen.  A value equal to the height of the texture indicates that the bottom edge of the texture should be at the center of the screen.

4.3 JavaScriptTrigger

The web.alive 3D virtual environment is implemented as a web plugin that can be embedded into a customer’s existing website. The JavaScript trigger can be used by content developers to allow actions taken by users within the 3D environment to result in updates to the webpage that incorporates the web.alive plugin. In this manner, the webpage content can be updated contextually on the fly based on the users location in the 3D environment. Furthermore, the web.alive solution as a whole can leverage the capabilities of existing web technologies such as web based whiteboards, file sharing applications, and many others by using java script triggers to facilitate the mashing up of integrated solutions.

The JavaScript trigger when invoked fires an event to the JavaScript associated with the encompassing webpage. The event will include the following information:

  • methodName - configurable string to match against in java script
  • Parameters - configurable string which can be parsed in java script
  • Pawn Session ID – the session ID of the pawn who invoked the java script trigger
  • Pawn Name – the name of the pawn who invoked the java script trigger
  • Authenticated – true if the pawn is authenticated; false if unathenticated
  • Associated Action – if the java script trigger was invoked by another trigger (for example the user clicking on a look and use trigger) than this is the action associated with the other trigger
  • Associated Volume Location Name – if the java script trigger was invoked by a user entering/leaving a particular volume than this is the location name of that particular volume
  • releaseMouseOnTrigger - configurable boolean which indicates if the mouse control should be released from the 3D environment when the java script trigger is invoked. For example, if the java script trigger is just going to update some read-only content on the webpage then this property should be set to false so the user’s mouse control remains capture by the 3D environment and they can continue to navigate throughout the 3D environment. However, if the java script trigger is launching a new web browser instance to allow the user to proceed to configure and buy a particular item on an e-commerce website then this property should be set to true since the user will need to have mouse control out of the environment so they may begin to interact with the newly launched webpage.
  • triggered (true if triggered, false if untriggered)

To use a JavaScriptTrigger open the Actor Browser in the web.alive Editor, navigate to Triggers, select the JavaScriptTrigger and place it in the level by right-clicking somewhere in your map and selecting “Add JavaScriptTrigger Here.” Open the trigger’s properties and set the “Events -> Tag” property to a unique tag for this JavaScriptTrigger which will be used to invoke this JavaScriptTrigger. Also set appropriate values for the properties found under the JavaScriptTrigger category.

Once the JavaScriptTrigger has been properly configured in the 3D environment using the web.alive Editor everything is in place to fire the appropriate java script event when the trigger is invoked. However, some additional work has to be done in the webpage’s web collateral in order to properly handle the Java Script event.
The “WAProcessEvent” method needs to be updated in the “WAEvent.js” file so that it handles the event as so desired. This often results in a new “if” statement being added to handle the event’s methodName value by doing the desired action on the webpage.

4.4 AnimationTrigger

Animation triggers allow users to play animations attached to a BasicPawn instance. The BasicPawn actor can be used to represent an object in the virtual environment which the content developer wishes to animate. Typically, a BasicPawn is added to the environment and its Mesh property is set to an already constructed Mesh which has a set of animations associated with it.

Once the BasicPawn has been configured and placed in the environment an animation trigger can be added for the purposes of playing animations on that BasicPawn. To use an AnimationTrigger open the Actor Browser in the web.alive Editor, navigate to Triggers, select the AnimationTrigger and place it in the level by right-clicking somewhere in your map and selecting “Add AnimationTrigger Here.” Open the trigger’s properties and set the “Events -> Tag” property to a unique tag for this AnimationTrigger which will be used to invoke this AnimationTrigger. Also set the “Event” property of the AnimationTrigger to the tag of the BasicPawn(s) you want to animate using this specific trigger.

Finally, you need to configure another trigger, such as a LookAndUseTrigger, which will invoke the AnimationTrigger. The exact name of the animation to play on the BasicPawn is passed from the trigger invoking the AnimationTrigger via its TriggerAction value. An example of how to use an AnimationTrigger can be found in Figure 26. Multiple initiating triggers can invoke the same AnimationTrigger to play different animations on the same BasicPawn(s) by setting different TriggerAction values on the initiating triggers.

4.5 VisibilityTrigger

Visibility triggers give you the option of dynamically hiding or showing an object. Setting up a visibility trigger requires an object to be hidden/shown and something to activate the visibility trigger such as a LookAndUseTrigger. Figure 27 illustrates a manner in which to setup a visibility trigger whereby one LookAndUseTrigger is used to hide the object and one is used to show the object.

To setup a VisibilityTrigger add one to the map, open its properties, and navigate to the Events section. Select the Event tag and type in the Tag of the object(s) you want to show/hide. A single visibility trigger can handle both hiding and showing of a set of objects. Please note that you cannot associate multiple visibility triggers with a single object. Now select the VisibilityTrigger’s Tag property and type in a name.

Finally, a trigger needs to be setup to invoke the VisibilityTrigger with an Event matching the tag of the VisiblityTrigger. Whether or not the VisibilityTrigger hides or shows the attached object depends on the TriggerAction of the invoking trigger. If the TriggerAction is set to “Hide” then the associated object will be hidden if the TriggerAction is set to “Show” then the associated object will be shown.

VisibilityTriggers don't work on StaticMeshes, but they will work on ChangeableStaticMeshes. To create a ChangeableStaticMesh, bring up the actor browser and select StaticMeshActor -> ChangeableStaticMeshActor, then goto to a viewport and r-click on it and add the actor to the map (A large cube will appear). Then bring up the properties of the actor, and update its Display -> StaticMesh attribute with the desired mesh.

4.6 TimerTrigger

The TimerTrigger is a fairly simple trigger type added as part of the web.alive product. Like other triggers, a TimerTrigger accepts an event from another trigger and passes an event to its target. However, the TimerTrigger differs from other triggers in that it waits a configurable amount of time before firing its event. The TimerTrigger passes itself as the “Other” actor to the event handler. As a result, the TimerTrigger’s TriggerAction is the value passed to the receiving object.

Timer Trigger Properties

Property Name   Default Value   Description
-------------   -------------   -----------
Delay           1.0             The delay in seconds to wait before firing the TimerTrigger’s event.

To use a TimerTrigger, open the Actor Class browser in the web.alive Editor and click on Triggers -> TimerTrigger. Then Right-click on the map and select “Add TimerTrigger Here” from the menu. Further configuration of the TimerTrigger usually proceeds by setting the Event, Tag, TriggerAction and Delay properties.

4.7 PitchLimiterTrigger

By default, users have restricted vertical view limits in web.alive that prevent the user from looking too far up or down while navigating in the virtual environment. These restricted vertical view limits aid novice users with navigating in the 3D virtual environment by preventing them from looking entirely at the ceiling or floor. Unfortunately, there are situations where these restricted vertical view limits can prevent users from interacting properly with virtual environment content. For example, sometimes a user wants to look straight down in order to interact with a button that is position directly in front of them or look straight up to view a movie screen. The PitchLimiterTrigger allows content developers to create areas that lessen or remove the restricted vertical view limits.

To use a PitchLimiterTrigger, open the Actor Class browser in the web.alive Editor and click on Triggers -> PitchLimiterTrigger. Then Right-click on the map and select “Add PitchLimiterTrigger Here” from the menu.
Typically, the PitchLimiterTrigger is triggered and untriggered by a generic Trigger by player proximity. That is, as the user walks into a proximity trigger’s collision cylinder an event is fired to the proximity trigger to adjust the user’s pitch limits. As the user leaves the proximity trigger’s collision cylinder an untrigger event is fired to the proximity trigger to reset the user’s pitch limits.

The pitch limits are defined in unreal rotation units (65536 = 360 degrees) with the origin being directly in front of the pawn with a value of 0 and the angle increasing as the camera rotates upwards and eventually wrapping around to the origin again as the value 65536. Figure 28 illustrates the origin and the default pitch limits. The PitchLimiterTrigger properties are explained in Table 4.

PitchLimiterTrigger Properties

Property Name   Default Value   Description
-------------   -------------   -----------
PitchDownLimit  0               A value of 0 indicates that the pitch down limit should not be modified by this trigger.  Usually values slightly lower than 61000 are used for this property in order to lessen the restriction on the vertical view down limit.
PitchUpLimit    0               A value of 0 indicates that the pitch up limit should not be modified by this trigger.  Usually values slightly higher than 4250 are used for this property in order to lessen the restriction on the vertical view up limit.

4.8 StareTrigger

The StareTrigger functions to recognize when a user is staring at a particular area for a predetermined amount of time when within a certain range of the area. It can be used to track which advertisements are the most effective in a virtual environment by logging which were stared at by the most users. In theory, it could also be used to signal sales personnel when a user has stared at a particular product long enough to indicate that they might be interested in purchasing the item.

To setup a StareTrigger, complete the following steps:

  1. In the web.alive Editor, open the Actor Browser and navigate to “Triggers”, select the “StareTrigger” and place it in the level by right-clicking somewhere in your map and selecting “Add StareTrigger Here”.
  2. Open the StareTrigger’s properties -> Events -> Event and type in the Tag of the object you’d like to trigger. In order for the StareTrigger to work properly a value must be entered into the Event property (even if the value doesn’t correspond to a tag in the environment).
  3. By default the StareTrigger is hidden and should be place directly over the object the content designer wants to track users staring at. The collision radius and collision height properties should be set to the minimal values which tightly cover the area of the object to be stared at. The Radii view, as shown in Figure 25, is particularly useful in placing the StareTrigger at the correct location with the proper collision sphere.
  4. Set the Range property to be the distance that a user must be within in order to effectively stare at the StareTrigger. It is suggested that the range be set to the distance that a user can be away from the StareTrigger and still be able to view whatever object the StareTrigger is associated with. That is, if the StareTrigger is associated with a sign then the StareTrigger range should be set to the distance at which a user can still easily make out the sign wording.
  5. Set the Delay property to the number of seconds a user must stare at the StareTrigger before an event is fired and logged.

4.9 ChainsawMaterialTrigger

The ChainsawMaterialTrigger is just like the native unreal MaterialTrigger except it also supports network clients (i.e. it synchronizes the current material between network clients). The ChainsawMaterialTrigger works with one or more MaterialSwitch materials. The associated MaterialSwitch materials simply iterates through an internal list of materials whenever it is triggered. The ChainsawMaterialTrigger cannot be triggered alone. It must be triggered by an external event (such as from a LookAndUseTrigger or Proximity trigger). The MaterialsToTrigger property should reference the MaterialSwitch materials which should be triggered. There is a limitation that only 20 MaterialSwitch materials can be referenced by a single ChainsawMaterialTrigger.

4.10 AvatarAnimationTrigger

The AvatarAnimationTrigger is a powerful trigger that allows the invoking avatar to be optionally teleported to a predetermined location, have a series animations ran on the avatar, and potentially teleport the avatar back to their original location. This trigger can be used to have the invoking avatar perform any number of activities. For example, it could be used to teleport the invoking avatar to the location of a chair, have the invoking avatar go from a standing to a sitting position (BeginAnimation), remain in a sitting position (IdleAnimation) until the user attempts to move, go from a sitting to a standing position (EndAnimtion), and finally teleport back to their original location.

AvatarAnimationTrigger Properties

Property Name           Default Value    Description
-------------           -------------    -----------
BeginAnimationName      None             Gives the name of the animation to run at the beginning on the interaction. 
IdleAnimationName       None             Gives the name of the idle animation to run while the avatar continues the interaction.
EndAnimationName        None             Gives the name of the animation to run at the end of the interaction.
EnableInitialTeleport   True             Indicates whether or not the invoking avatar should be teleported to the location of the AvatarAnimationTrigger and have its rotation set to the same rotation as the AvatarAnimationTrigger.
EnableReturnTeleport    True             Indicates whether or not the invoking avatar should be teleported back to their original location and rotation when the interaction is complete.  

To setup an AvatarAnimationTrigger, complete the following steps:

  1. Open the Actor Browser in the web.alive editor, navigate to Triggers, select the AvatarAnimationTrigger and place it in the level by right-clicking somewhere in your map and selecting “Add AvatarAnimationTrigger Here.”
  2. If you plan on teleporting the invoking avatar to the location of the AvatarAnimationTrigger upon invocation then carefully place the AvatarAnimationTrigger at the desired teleport location with the desired rotation.
  3. Open the trigger’s properties and set the “Events -> Tag” property to a unique tag for this AvatarAnimationTrigger which will be used to invoke this AvatarAnimationTrigger.
  4. Set the AvatarAnimationTrigger properties appropriately based on their descriptions found in Table 5.
  5. Finally, you need to configure another trigger, such as a LookAndUseTrigger, which will invoke the AvatarAnimationTrigger.