public class SoVRMLTimeSensor extends SoVRMLInterpolator
<font color="#0000FF">NOTE:</font> This class does not exist in Open Inventor 10.0 and later.
This section describes the expected behavior of the node in a conforming VRML97 browser application. In some cases, the application is responsible for implementing portions of the expected behavior. Open Inventor viewer classes and IVF classes implement some of the application behaviors.
This section may reference portions of the VRML97 specification that are not present in this help file. The complete VRML97 spec is available at
SoVRMLTimeSensors generate events as time passes. SoVRMLTimeSensors can be used to drive continuous simulations and animations, periodic activities (e.g., one per minute), and/or single occurrence events such as an alarm clock.
SoVRMLTimeSensor discrete eventOuts include: isActive , which becomes true when the
SoVRMLTimeSensor begins running, and false when it stops running, and cycleTime , a time event at
startTime and at the beginning of each new cycle (useful for synchronization with other time-based objects). The remaining outputs generate continuous events and consist of fraction_changed , which is an SFFloat in the closed interval [0,1] representing the completed fraction of the current cycle, and time , an SFTime event specifying the absolute time for a given simulation tick.
enabled exposedField is true, the
SoVRMLTimeSensor is enabled and may be running. If a set_enabled false event is received while the
SoVRMLTimeSensor is running, then the sensor should evaluate and send all relevant outputs, send a false value for isActive, and disable itself. However, events on the exposedFields of the
SoVRMLTimeSensor (such as set_startTime) are processed and their corresponding eventOuts ( startTime_changed) are sent regardless of the state of
enabled. The remaining discussion assumes
enabled is true.
stopTime exposedFields, and the isActive eventOut and their affects on the
SoVRMLTimeSensor node, are discussed in detail in the "Concepts - Time Dependent Nodes" section. The "cycle" of an
SoVRMLTimeSensor lasts for
cycleInterval seconds. The value of
cycleInterval must be greater than 0 (a value less than or equal to 0 produces undefined results). Because the
SoVRMLTimeSensor is more complex than the abstract SoVRMLTimeDep node and generates continuous eventOuts, some of the information in the "Time Dependent Nodes" section is repeated here.
A cycleTime eventOut can be used for synchronization purposes, e.g., sound with animation. The value of a cycleTime eventOut will be equal to the time at the beginning of the current cycle. A cycleTime eventOut is generated at the beginning of every cycle, including the cycle starting at
startTime. The first cycleTime eventOut for an
SoVRMLTimeSensor node can be used as an alarm (single pulse at a specified time).
SoVRMLTimeSensor becomes active it will generate an isActive = true event and begin generating time , fraction_changed, and cycleTime events, which may be routed to other nodes to drive animation or simulated behaviors - (see below for behavior at read time). The time event outputs the absolute time for a given tick of the
SoVRMLTimeSensor (time fields and events represent the number of seconds since midnight GMT January 1, 1970). fraction_changed events output a floating point value in the closed interval [0, 1], where 0 corresponds to
startTime and 1 corresponds to
startTime + N*
cycleInterval, where N = 1, 2, ... . That is, the time and fraction_changed eventOuts can be computed as:
time = now f = fmod(now - startTime, cycleInterval) if (f == 0.0 && now > startTime) fraction_changed = 1.0 else fraction_changed = f / cycleInterval
SoVRMLTimeSensorcan be set up to be active at read time by specifying
looptrue (not the default) and
startTime(satisfied by the default values). The time events output absolute times for each tick of the
startTimeand end with either
stopTime, or loop forever depending on the values of the other fields. An active
SoVRMLTimeSensormust stop at the first simulation tick when time now >=
No guarantees are made with respect to how often an
SoVRMLTimeSensor will generate time events, but an
SoVRMLTimeSensor should generate events at least at every simulation tick. SoVRMLTimeSensors are guaranteed to generate final time and fraction_changed events. If loop is false, the final time event will be generated with a value of (
stopTime > startTime), whichever value is less. If
loop is true at the completion of every cycle, then the final event will be generated as evaluated at
startTime) or never.
SoVRMLTimeSensor ignores set_cycleInterval , and set_startTime events. An active
SoVRMLTimeSensor also ignores set_stopTime events for set_stopTime <
startTime. For example, if a set_startTime event is received while an
SoVRMLTimeSensor is active, then that set_startTime event is ignored (the
startTime field is not changed, and a startTime_changed eventOut is not generated). If an active
SoVRMLTimeSensor receives a set_stopTime event that is less than
now and greater than or equal to
startTime, it behaves as if the
stopTime requested is
now and sends the final events based on
now (note that
stopTime is set as specified in the eventIn).
|set_pauseTime (Note: Not implemented)|
|set_resumeTime (Note: Not implemented)|
|isPaused (Note: Not implemented)|
|pauseTime_changed (Note: Not implemented)|
|resumeTime_changed (Note: Not implemented)|
|Modifier and Type||Field and Description|
Time for each cycle in seconds.
Enables (true) or disables (false) the sensor.
Specifies whether a cycle should be repeated (true) or terminated (false) at the end of the cycle.
(Note: Not implemented) Pause time.
(Note: Not implemented) Resume time.
Starting time of the cycle.
Stop time of the cycle.
|Constructor and Description|
|Modifier and Type||Method and Description|
Enables/disables events for all
Queries if events are enabled for all objects of this class.
copy, evaluateWrapper, getByName, getOutput, getOutputName
affectsState, callback, copy, distribute, doAction, getAlternateRep, getBoundingBox, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizable
getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
public final SoSFTime cycleInterval
public final SoSFBool enabled
public final SoSFBool loop
public final SoSFTime pauseTime
public final SoSFTime resumeTime
public final SoSFTime startTime
public final SoSFTime stopTime
public static boolean isEventsEnabled()
public static void enableEvents(boolean OnOffFlag)
SoVRMLTimeSensorobjects. If you have created several objects of this class, you can disable/enable events for all of them with a single call to this method.
Generated on September 3, 2019, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com