Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoTrackFollower Class Reference

VSG extension Animates an object or camera along a track More...

#include <Inventor/engines/SoTrackFollower.h>

+ Inheritance diagram for SoTrackFollower:

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoTrackFollower ()
 Constructor.
 
- Public Member Functions inherited from SoEngine
virtual int getOutputs (SoEngineOutputList &list) const
 Returns a list of outputs in this engine.
 
SoEngineOutputgetOutput (const SbName &outputName) const
 Returns a reference to the engine output with the given name.
 
SbBool getOutputName (const SoEngineOutput *output, SbName &outputName) const
 Returns (in outputName) the name of the engine output (output).
 
SoEnginecopy () const
 Creates and returns an exact copy of the engine.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoEngine
static SoType getClassTypeId ()
 Returns the type identifier for the SoEngine class.
 
static SoEnginegetByName (const SbName &name)
 Looks up engine(s) by name.
 
static int getByName (const SbName &name, SoEngineList &list)
 Looks up engine(s) by name.
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Public Attributes

SoMFVec3f points
 Coordinates of the control points.
 
SoMFFloat timeStamps
 Time stamps associated with the control points.
 
SoMFFloat radius
 Radius of the turn at a control point.
 
SoMFFloat rollAngle
 Roll angle during the turn at a control point.
 
SoMFFloat rollSpeed
 Speed at which the roll angle is reached during a turn.
 
SoMFBool keepRollAngle
 Indicates if the roll angle should be maintained after the middle of the turn.
 
SoMFRotation headRotation
 The final rotation applied at a control point, which allows the camera or the object to be rotated while following the track.
 
SoSFFloat alpha
 The value on which the interpolation is made.
 
SoSFBool loop
 If loop is TRUE, the animation will loop.
 
SoSFBool useHeadRotationOnly
 If TRUE, the orientation output field is a direct interpolation of headRotation values, without taking into consideration the roll angle or the track itself.
 
SoEngineOutput position
 (SoSFVec3f) Position interpolated from the alpha value.
 
SoEngineOutput orientation
 (SoSFRotation) Rotation interpolated from the alpha value.
 

Detailed Description

VSG extension Animates an object or camera along a track

This engine is designed to add animations to a scene graph. It manages a track that can be followed either by an object (a sub scene graph) or by a camera. The track is defined by a set of control points. Each control point can be associated with a time stamp, a turn angle, roll information, and a head rotation. Only the points field is required. All other data fields are optional.

The input that drives the animation is the alpha field. This value should vary between 0 and 1, assuming 0 as the position and orientation at the first control point, and 1 as the position and orientation at the last control point. Alpha values are clamped to the interval [0,1]. An SoTimerSensor or other engines can be used to dynamically modify the alpha value.

The outputs are a position field and an orientation field that can be connected directly to the corresponding fields of an SoCamera or SoTransform node (see SoField::connectFrom). The values of these fields are computed by interpolating the track points with the alpha field value.

The rollAngle values are only used if the track specified by the points field is curved.

An example .iv file using SoTrackFollower is provided in the directory $OIVHOME/data/models/toys/TrackSample.

FILE FORMAT/DEFAULT

    TrackFollower {
    points 0 0 0
    timeStamps 0
    radius 0
    rollAngle 0
    rollSpeed 0
    keepRollAngle FALSE
    headRotation 0 0 1 0
    alpha 0
    loop TRUE
    useHeadRotationOnly FALSE
    }

SEE ALSO

SoInterpolate

Definition at line 103 of file SoTrackFollower.h.

Constructor & Destructor Documentation

◆ SoTrackFollower()

SoTrackFollower::SoTrackFollower ( )

Constructor.

Member Function Documentation

◆ getClassTypeId()

static SoType SoTrackFollower::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getTypeId()

virtual SoType SoTrackFollower::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Implements SoTypedObject.

Member Data Documentation

◆ alpha

SoSFFloat SoTrackFollower::alpha

The value on which the interpolation is made.

It must between 0.0 and 1.0.

Definition at line 213 of file SoTrackFollower.h.

◆ headRotation

SoMFRotation SoTrackFollower::headRotation

The final rotation applied at a control point, which allows the camera or the object to be rotated while following the track.

If there are fewer headRotation values than control points, the value of the last headRotation is used for the remaining control points.

Definition at line 208 of file SoTrackFollower.h.

◆ keepRollAngle

SoMFBool SoTrackFollower::keepRollAngle

Indicates if the roll angle should be maintained after the middle of the turn.

If this flag is set to TRUE for a control point, the roll speed is assumed to be 1 in the second part of the turn for the current control point and in the first part of the turn for the next control point. This allows the roll angle to be maintained between two adjacent turns.

If there are fewer keepRollAngle values than control points, the value of the last keepRollAngle is used for the remaining control points.

Definition at line 199 of file SoTrackFollower.h.

◆ loop

SoSFBool SoTrackFollower::loop

If loop is TRUE, the animation will loop.

For N control points, there must be N+1 time stamps. The last time stamp is used for interpolating between the last control point and the first control point at the end of the animation loop. For example, if there are four points (P1, P2, P3, and P4), there must be five time stamps (T1,... T5) as shown below:

Definition at line 225 of file SoTrackFollower.h.

◆ orientation

SoEngineOutput SoTrackFollower::orientation

(SoSFRotation) Rotation interpolated from the alpha value.

It's a rotation from the -Z vector to the heading vector, with the initial up vector along the Y vector.

Definition at line 246 of file SoTrackFollower.h.

◆ points

SoMFVec3f SoTrackFollower::points

Coordinates of the control points.

Definition at line 113 of file SoTrackFollower.h.

◆ position

SoEngineOutput SoTrackFollower::position

(SoSFVec3f) Position interpolated from the alpha value.

Definition at line 239 of file SoTrackFollower.h.

◆ radius

SoMFFloat SoTrackFollower::radius

Radius of the turn at a control point.

If radius is zero for a control point (the default), the orientation changes immediately when the animation reachs that point. For many animations this is an unrealistic or undesirable behavior. Radius values allow the orientation to change smoothly, following a curve.

If there are fewer radius values than control points, the value of the last radius is used for the remaining control points.

Definition at line 156 of file SoTrackFollower.h.

◆ rollAngle

SoMFFloat SoTrackFollower::rollAngle

Roll angle during the turn at a control point.

The roll angle inclines the track inside the turn. If the specified roll angle is negative, the track is inclined outside the turn.

If rollAngle is zero for a control point (the default), the animated object will rotate around a vector perpendicular to the plane defined by the preceding and following segments of the track. This is typically the desired behavior, for example, when animating a vehicle on the ground. However rollAngle allows a more realistic animation of a flying vehicle.

If there are fewer rollAngle values than control points, the value of the last rollAngle is used for the remaining control points.

Definition at line 174 of file SoTrackFollower.h.

◆ rollSpeed

SoMFFloat SoTrackFollower::rollSpeed

Speed at which the roll angle is reached during a turn.

By default, (value = 0) the roll angle varies from 0 at the beginning of the turn to the specified roll angle value in the middle of the turn and then back to 0 at the end of the turn. A value of 1 means the roll angle is immediately reached at the begining of the turn. Intermediate values vary the point at which the full roll angle is reached.

If there are fewer rollSpeed values than control points, the value of the last rollSpeed is used for the remaining control points.

Definition at line 187 of file SoTrackFollower.h.

◆ timeStamps

SoMFFloat SoTrackFollower::timeStamps

Time stamps associated with the control points.

A time stamp represents the time at which a control point must be reached; the "scale" of the time is independent of the animation time. However, it is proportional to it. For example, if point 1 has a time stamp value of 10, point 2 has a time stamp value of 30, and point 3 has a time stamp value of 40, it means that the interpolation will take twice as long to go from point 1 to point 2 (20 time units) as it will to go from point 2 to point 3 (10 time units). The actual time to complete an animation, and therefore the overall speed, is determined by the time it takes for the alpha value to go from 0 to 1. In other words, the overall speed is controlled by the application or another engine which is updating the alpha input.

If a time stamp has a value of SO_UNDEFINED_TIME_STAMP (default value), then the computed time stamp is proportional to the distance between the previous and the next control point, i.e., speed is constant. If all the time stamps are set to SO_UNDEFINED_TIME_STAMP or are not set at all, they are all computed to be proportional to the distance between the points, and speed is constant over the entire track.

If the time stamp field contains one more value than the points field, the last time stamp is assumed to apply to the first/last control point in a loop. If fewer than 3 time stamps are provided, the track is interpolated proportional to the distance between control points.

Definition at line 144 of file SoTrackFollower.h.

◆ useHeadRotationOnly

SoSFBool SoTrackFollower::useHeadRotationOnly

If TRUE, the orientation output field is a direct interpolation of headRotation values, without taking into consideration the roll angle or the track itself.

Definition at line 232 of file SoTrackFollower.h.


The documentation for this class was generated from the following file: