The SceneGraph3D Description Language

Home About EaZD Deferred renderer API SceneGraph3D API SceneGraph3D scene description language

Index

| Scene file structure | camera | character | directory | eventmessage | group | input | light | linearmotion | material | node | object | proximitytrigger | skylight | spinner | surface | transformation | user | world |

proximitytrigger

Derived from: Node3D
Class name: ProximityTrigger3D
Placement: Anywhere
Description: This is the first of a family of triggers that are available in the scene graph. It triggers three types of events, depending on the containment of one or more of registered nodes in its area of effect. The nodes are registered through messages to the proximitytrigger object. The three events correspond to a node entering, exiting and being inside the trigger's area of effect. The area of effect of the trigger can be a spherical one, a box, or a halfspace (the scene file contains the equation of the dividing plane in space). The position, orientation and scale of the trigger's extends are affected by the transformations applied to the node.
Special notes: -
Inherited attributes: name, active, visible
New attributes:
attribute type description
shape OPTION
sphere
box
plane
Defines the shape of the area of effect of the proximity sensor. The default shape is the sphere.
position VEC3 The center of the trigger. Applicable to the sphere and box shape types. Initially set to (0,0,0).
radius FLOAT The radius of the sphere. Applicable only to the spherical shape. Initial value is 1.0.
normal VEC3 The normal of the dividing plane. Applicable only to the planar trigger shape. Initial value is (0,1,0).
offset FLOAT The offset of the plane from the local coordinate system origin. Initial value is 0.0.
size VEC3 The size of the box in local units. Applicable only to the box-shaped trigger. Default value is (1,1,1).
mode OPTION
center
volume
Defines the criterion for containment of a node to the trigger's area of effect. If center is selected, the trigger checks if the position (center) of the queries node lies within the area of effect. If the volume option is used, the entire volume of the queried node must lie within the area of effect in order to trigger an enter event. Currently, only the center mode is supported.
Events:
event name condition
enter Issued whenever the first of the registered nodes is found entering the area of the effect of the trigger.
exit Issued when the last of the registered nodes exits the area of effect of the trigger.
inside Issued when at least one of the registered nodes lies within the area of effect of the trigger.
Inherited events: -
New messages:
attribute value description
position VEC3 Same as corresponding node attribute.
size VEC3 Same as corresponding node attribute.
offset FLOAT Same as corresponding node attribute.
normal VEC3 Same as corresponding node attribute.
radius FLOAT Same as corresponding node attribute.
watch STRING Declare a node to check for containment. Multiple nodes can be queried this way. See the event section for the exact conditions of event triggering.
Inherited messages: active, visible, hide, show, deactivate, enable, activate, disable
Redefined messages: -
Obsolete messages: -


Example

<world ambient_occlusion="ssao" bloom="yes" shadows="disk" 
       ao_radius="6" ambient="0.3 0.3 0.3" defocus="yes">
       
    <eventmessage event="init" recipient="trigger1" delay="0.0" message="watch Myself">
    </eventmessage>  

    <camera name="first_person" apperture="50.0" 
            focal_distance ="30.0" focal_range="30.0"
            near="2.0" far="1000" follow="Myself" primary="true">
    </camera> 

    <transformation name="environment" scale="1.0,1.0,1.0" translation="0,0,-10">
        
        <object name="geom1" file="arena.obj"></object>
    
    </transformation>
 
    <user name="Myself" control="navigate" speed="2.0" turn="0.5"
          position="0,10,100" lookat="0,10,0" input="Console">
    </user>

    <input name="Console" type="mousekeyboard">
    </input>
    
    <proximitytrigger name="trigger1" shape="sphere" radius="30" position="0,10,-50">
        <eventmessage event="enter" recipient="geom1" delay="0.0" message="hide">
        </eventmessage>
        <eventmessage event="exit" recipient="geom1" delay="0.0" message="show">
        </eventmessage>
    </proximitytrigger>

</world>

Last update: 16 Feb. 2009