*** sgi-sensors.html Mon Dec 4 10:42:50 1995 --- vrml-sensors.html Mon Dec 4 11:00:05 1995 *************** *** 1,13 **** ! SGI Sensors

Sensors: input

!

General notes: Given a "thick enough" API for Logic nodes, Sensors could ! all be implemented as prototyped Logic nodes. Although it may make sense to define such a rich API eventually, in the short term we believe it makes more sense to build that functionality into pre-defined classes. ! Later versions ! of the VRML spec might choose to describe these as pre-define prototypes, ! along with their implementation using Logic nodes.

!

Proximity Sensors

Proximity sensors are nodes that generates events when the viewpoint enters, exits, and moves inside a space. A proximity sensor can be activated or inactivated by sending it an "enable" event with a value of TRUE/FALSE. enter and exit events are generated when the viewpoint enters/exits the region and contain --- 1,30 ---- ! Mitra - Sensors ! This is adapted from SGI's proposal - Click Here for a diff !
Mitra <mitra@mitra.biz>, 4 Dec 95. !

Sensors: input

!

General notes: Given a "thick enough" API for Script nodes, Sensors could ! all be implemented as prototyped Script nodes. Although it may make sense to define such a rich API eventually, in the short term we believe it makes more sense to build that functionality into pre-defined classes. !

!

To allow Sensors to be composed in the VRML file separately from the object they are monitoring, they each have an eventOn field which can reference a target object to be monitored. If this field is left as the default, then it refers to the Separator that the sensor is a child of, with the effect that: !

!     Separator {
!         ClickSensor { ... }
!         Cube { ... }
!         Cone { ... }
!     }
! 
! will generate events whenever the Cube or Cone are clicked on. The reason for this is to allow ClickSensors to be added later by behaviors without requiring the scene graph to be edited. !

When a sensor is triggered, it generates an event to its actionObject, which defaults to the object it is attached to. This event contains a pointer back to the sensor, which the script can access (via the API) to query particular values. This has the big advantage of leaving it up to the script as to how much information it needs, or whether to ignore the event entirely, it also avoids having to route all the "eventOut" fields of a sensor to a LogicNode field. The actionMethod field can be used to call a particular event on a destination ScriptNode. The actionParameters can be used by the destination ScriptNode to distinguish between sending sensors, or to send parameters to scripts. !

Each sensor as a set of eventFlags, these control: !

!

Proximity Sensors

Proximity sensors are nodes that generates events when the viewpoint enters, exits, and moves inside a space. A proximity sensor can be activated or inactivated by sending it an "enable" event with a value of TRUE/FALSE. enter and exit events are generated when the viewpoint enters/exits the region and contain *************** *** 37,43 **** center 0 0 0 # SFVec3f size 0 0 0 # SFVec3f enabled TRUE # SFBool ! # eventIn SFBool setEnabled # eventOut SFTime enter # eventOut SFTime exit # eventOut SFVec3f position --- 54,65 ---- center 0 0 0 # SFVec3f size 0 0 0 # SFVec3f enabled TRUE # SFBool ! enabled TRUE # SFBool ! eventOn Parent # SFNode ! actionObject Parent # SFNode ! actionMethod "Proximity" # SFString ! actionParameters SFNode Self # MFFields ! # eventIn SFBool setEnabled # eventOut SFTime enter # eventOut SFTime exit # eventOut SFVec3f position *************** *** 52,57 **** --- 74,103 ---- PointProximitySensor { center 0 0 0 # SFVec3f radius 0 # SFFloat + eventOn Parent # SFNode + actionObject Parent # SFNode + actionMethod "Proximity" # SFString + actionParameters SFNode Self # MFFields + # eventIn SFBool setEnabled + # eventOut SFTime enter + # eventOut SFTime exit + # eventOut SFVec3f position + # eventOut SFRotation orientation + } + +

CollisionSensor

+

The CollisionSensor node reports when the camera collides with the + object that is specified by the "eventOn". It complements the CollideStyle node which controls + at a course level whether the user can enter the object being collided with.

+
+ FILE FORMAT/DEFAULTS
+     CollisionSensor {
+           enabled  TRUE         # SFBool
+           enabled  TRUE         # SFBool
+           eventOn  Parent        # SFNode
+           actionObject    Parent # SFNode
+           actionMethod    "Proximity" # SFString
+           actionParameter "" # SFString
            # eventIn SFBool setEnabled 
            # eventOut SFTime enter
            # eventOut SFTime exit
***************
*** 59,82 ****
            # eventOut SFRotation orientation
       }
  
!

Pointing Device Sensors

A PointingDeviceSensor is a node which tracks the pointing device with respect to its child geometry. A PointingDeviceSensor can be made active/inactive by being sent enable events. There are two types of PointingDeviceSensors; ClickSensor and DragSensors.

!

Pointing device sensors may be nested, with the rule being that the sensors ! lowest in the scene hierarchy will have first change to 'grab' user input; ! if user input is 'grabbed', sensors higher in the hierarchy will not have ! a chance to process it.

ClickSensor

The ClickSensor generates events as the pointing device passes over its ! child geometry, and when the pointing device is over its child geometry will also generate button press and release events for the button associated with the pointing device. Typically, the pointing device is a mouse and the button is a mouse button.

An enter event is generated when the pointing device passes over any of the shape nodes contained underneath the ClickSensor and contains the time at which ! the event occured. Likewise, an exit event is generated when the pointing device is no longer over any of the ! ClickSensor's children. isOver events are generated when enter/exit events are generated; an isOver event with a TRUE value is generated at the same time as enter events, and an isOver FALSE event is generated with exit events.

Should we say anything about what happens if the cursor stays still but --- 105,133 ---- # eventOut SFRotation orientation } !

Pointing Device Sensors

A PointingDeviceSensor is a node which tracks the pointing device with respect to its child geometry. A PointingDeviceSensor can be made active/inactive by being sent enable events. There are two types of PointingDeviceSensors; ClickSensor and DragSensors.

!

moveChildrencontrols whether the children's geometry should be moved as the pointer does. !

Open issueIt may be usefull to add a SFBitField that controls which of the events are sent. !

Cascading events and Global Event

! In a situation where an event can be triggered by a pick on a hand, but then be activated by the Sensor on the arm, we have to have a clear set of rules as to who gets what events, in what order. !
Open: There are several open issues on this, this should be taken as one proposal only. !

! Events are first processed by looking at a set of queues of Sensors. The first place to check is the "GlobalEvents" pseudo-object, which allow for Modal situations such as "the next place clicked is the destination". Then the object on which the event occured is checked (e.g. the hand), then that object's parent in the scene graph, and so-on up the hierarchy. !

! Finer control over the event is done through two flags "HANDLED" and "IGNOREHANDLED", if a Sensor is marked "HANDLED" then once an event has been handled by this Sensor, the event is marked as "HANDLED" as it goes up the hierarchy. If an Sensor is marked as "IGNOREHANDLED" then in an event that has already been "HANDLED" will be ignored by it. !

ClickSensor

The ClickSensor generates events as the pointing device passes over its ! child geometry, and when the pointing device is over the sensed object. will also generate button press and release events for the button associated with the pointing device. Typically, the pointing device is a mouse and the button is a mouse button.

An enter event is generated when the pointing device passes over any of the shape nodes contained underneath the ClickSensor and contains the time at which ! the event occured. Likewise, an exit event is generated when the pointing device is no longer over the sensed object. isOver events are generated when enter/exit events are generated; an isOver event with a TRUE value is generated at the same time as enter events, and an isOver FALSE event is generated with exit events.

Should we say anything about what happens if the cursor stays still but *************** *** 105,110 **** --- 156,166 ---- FILE FORMAT/DEFAULTS ClickSensor { enabled TRUE # SFBool + moveChildren FALSE # SFBool + eventOn Parent # SFNode + actionObject Parent # SFNode + actionMethod "Click" # SFString + actionParameters SFNode Self # MFFields # eventIn SFBool setEnabled # eventOut SFTime enter # eventOut SFTime exit *************** *** 117,123 **** # eventOut SFVec2f hitTexture } !

DragSensors

A DragSensor tracks pointing and clicking over its child geometry just like the ClickSensor; however, DragSensors track dragging in manner suitable for continuous controllers such as sliders, knobs, and levers. When the --- 173,179 ---- # eventOut SFVec2f hitTexture } !

DragSensors

A DragSensor tracks pointing and clicking over its child geometry just like the ClickSensor; however, DragSensors track dragging in manner suitable for continuous controllers such as sliders, knobs, and levers. When the *************** *** 138,143 **** --- 194,204 ---- minPosition 0 # SFFloat maxPosition 0 # SFFloat enabled TRUE # SFBool + moveChildren FALSE # SFBool + eventOn Parent # SFNode + actionObject Parent # SFNode + actionMethod "Line" # SFString + actionParameters SFNode Self # MFFields # eventIn SFBool setEnabled # eventOut SFTime enter # eventOut SFTime exit *************** *** 163,169 **** minPosition 0 0 # SFVec2f maxPosition 0 0 # SFVec2f enabled TRUE # SFBool ! # eventIn SFBool setEnabled # eventOut SFTime enter # eventOut SFTime exit # eventOut SFBool isOver --- 224,235 ---- minPosition 0 0 # SFVec2f maxPosition 0 0 # SFVec2f enabled TRUE # SFBool ! moveChildren FALSE # SFBool ! eventOn Parent # SFNode ! actionObject Parent # SFNode ! actionMethod "Plane" # SFString ! actionParameters SFNode Self # MFFields ! # eventIn SFBool setEnabled # eventOut SFTime enter # eventOut SFTime exit # eventOut SFBool isOver *************** *** 189,194 **** --- 255,265 ---- minAngle 0 # SFFloat (radians) maxAngle 0 # SFFloat (radians) enabled TRUE # SFBool + moveChildren FALSE # SFBool + eventOn Parent # SFNode + actionObject Parent # SFNode + actionMethod "Disk" # SFString + actionParameters SFNode Self # MFFields # eventIn SFBool setEnabled # eventOut SFTime enter # eventOut SFTime exit *************** *** 214,219 **** --- 285,295 ---- minAngle 0 # SFFloat (radians) maxAngle 0 # SFFloat (radians) enabled TRUE # SFBool + moveChildren FALSE # SFBool + eventOn Parent # SFNode + actionObject Parent # SFNode + actionMethod "Cylinder" # SFString + actionParameters SFNode Self # MFFields # eventIn SFBool setEnabled # eventOut SFTime enter # eventOut SFTime exit *************** *** 242,247 **** --- 318,328 ---- FILE FORMAT/DEFAULTS SphereSensor { enabled TRUE # SFBool + moveChildren FALSE # SFBool + eventOn Parent # SFNode + actionObject Parent # SFNode + actionMethod "Sphere" # SFString + actionParameters SFNode Self # MFFields # eventIn SFBool setEnabled # eventOut SFTime enter # eventOut SFTime exit *************** *** 263,282 **** cylinder, or in the plane perpendicular to the view vector if the cursor moves off of the sphere. An onSphere TRUE event is generated at the initial click down; thereafter, onSphere FALSE/TRUE events are generated if the pointing device is dragged off/on the cylinder.

!

VisibilitySensor

!

A visibility sensor generates visible/notVisible events, and can be used to make a script take up less CPU time when the things the script ! is controlling are not visible (for example, don't bother doing an elaborate ! walk-cycle animation if the character is not visible; instead, just modify ! its overall position/orientation).

!

There are some issues here about when visibility should be determined; I predict it will be a bit tricky to implement a browser ! that doesn't suffer from "off-by-one" visibility errors, but we might just ! leave that as a quality-of-implementation issue and not spec exact behavior ! (I'm sure we won't require exact visibility computation, anyway...).

!
! FILE FORMAT/DEFAULTS
!      VisibilitySensor {
!           enabled  TRUE  # SFBool
!           # eventIn  SFBool     setEnabled
!           # eventOut SFBool     visible
!      }
! 
--- 344,349 ---- cylinder, or in the plane perpendicular to the view vector if the cursor moves off of the sphere. An onSphere TRUE event is generated at the initial click down; thereafter, onSphere FALSE/TRUE events are generated if the pointing device is dragged off/on the cylinder.

! !