Orxonox  0.0.5 Codename: Arcturus
Files | Classes | Enumerations
Trigger

Triggers are objects which react to certain events by changing their boolean state. More...

Files

file  CheckPoint.cc
 Implementation of the CheckPoint class.
 
file  CheckPoint.h
 Definition of the CheckPoint class.
 
file  DistanceTrigger.cc
 Implementation of the DistanceTrigger class.
 
file  DistanceTrigger.h
 Definition of the DistanceTrigger class.
 
file  EventTrigger.cc
 Implementation of the EventTrigger class.
 
file  EventTrigger.h
 Definition of the EventTrigger class.
 
file  Trigger.cc
 Implementation of the Trigger class.
 
file  Trigger.h
 Definition of the Trigger class.
 

Classes

class  orxonox::CheckPoint
 
class  orxonox::DistanceTrigger
 The DistanceTrigger is a Trigger that triggers whenever an object (that is of the specified target type) is in a specified range of the DistanceTrigger. More...
 
class  orxonox::EventTrigger
 The EventTrigger class provides a way to have a Trigger triggered by any kinds of Events. More...
 
class  orxonox::Trigger
 A Trigger is an object that can either be active or inactive, with a specified behavior how to switch between the two. More...
 

Enumerations

enum  orxonox::DistanceTriggerBeaconMode { orxonox::DistanceTriggerBeaconMode::off, orxonox::DistanceTriggerBeaconMode::identify, orxonox::DistanceTriggerBeaconMode::exclude }
 Enum for the beacon mode of the DistanceTrigger. More...
 

Detailed Description

Triggers are objects which react to certain events by changing their boolean state.

That state is the trigger's activity orxonox::Trigger can be either active or not active.

Technical Details

A common Trigger is an object that can either be active or inactive, with a specified behavior how to switch between the two. Each time a switch occurs an Event is fired (see the Eventsystem for more information about how that works exactly), with th Trigger as the originator. This way the entity that reacts to the Trigger triggering receives information about the Trigger that created the Event. If the Trigger is also a PlayerTrigger, under some conditions, the entity that caused the Trigger to trigger can be accessed.

Also, just as with all triggers, Triggers can be nested (even with e.g. MultiTriggers).

<Trigger switch="true" delay="2">
<DistanceTrigger position="100,0,0" distance="80" />
<EventMultiTrigger ... />
</Trigger>

Triggers also allow for additional complexity which can be added through the choice of the parameters explained below. But first it is important to understand a small implementation detail. There is a distinction between the Trigger being triggered (there is the state triggered for that) and the Trigger being active (for that is the state activity). From the outside only the activity is visible. The state triggered tells us whether the trigger is actually triggered, but it could pretend (for some reason, some of which we will see shortly) to be active to the outside, while it in fact isn't. The standard behavior is, that the activity changes, when the Trigger transits from being triggered to being not triggered or the other way around.

The parameters of the Trigger are:

Sub-types of Triggers

EventTrigger

An EventTrigger can either be used to be triggered when an Event, that itself is triggering, arrives at its event port.

A common usage could look like this:

<EventTrigger invert="true" delay="1">
<events>
<trigger>
<Trigger ... />
<Trigger ... />
</trigger>
</events>
</EventTrigger>

DistanceTrigger

The DistanceTrigger is a Trigger that triggers whenever an object (that is of the specified target type) is in a specified range of the DistanceTrigger. The object can be specified further by setting the beaconMode and attaching a DistanceTriggerBeacon to the object. Parameters are (additional to the ones of Trigger):

A simple DistanceTrigger could look like this:

<DistanceTrigger position="0,0,0" switch="true" target="Pawn" distance="20" />

An implementation that only reacts to objects with a DistanceTriggerBeacon attached would look like this:

<DistanceTrigger position="0,0,0" target="Pawn" beaconMode="identify" targetname="beacon1" distance="30" />

This particular DistanceTrigger would only react if an object was in range, that had a DistanceTriggerBeacon with the name beacon1 attached.

Enumeration Type Documentation

Enum for the beacon mode of the DistanceTrigger.

Enumerator
off 
identify 
exclude