- All Implemented Interfaces:
public class SoTrackFollower extends SoEngineAnimates 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
pointsfield is required. All other data fields are optional.
The input that drives the animation is the
alphafield. 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
SoTimerSensoror other engines can be used to dynamically modify the alpha value.
The outputs are a
positionfield and an
orientationfield that can be connected directly to the corresponding fields of an
SoField.connectFrom). The values of these fields are computed by interpolating the track points with the
The rollAngle values are only used if the track specified by the points field is curved.
An example .iv file using
SoTrackFolloweris provided in the directory $OIVHOME/data/models/toys/TrackSample.
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:
Fields Modifier and Type Field Description
alphaThe value on which the interpolation is made.
headRotationThe final rotation applied at a control point, which allows the camera or the object to be rotated while following the track.
keepRollAngleIndicates if the roll angle should be maintained after the middle of the turn.
loopIf loop is true, the animation will loop.
pointsCoordinates of the control points.
radiusRadius of the turn at a control point.
rollAngleRoll angle during the turn at a control point.
rollSpeedSpeed at which the roll angle is reached during a turn.
timeStampsTime stamps associated with the control points.
Constructors Constructor Description
Methods inherited from class com.openinventor.inventor.engines.SoEngine
copy, getByName, getOutput, getOutputName
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable, touch
public final SoMFVec3f pointsCoordinates of the control points.
public final SoMFFloat timeStampsTime 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
alphavalue 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.
public final SoMFFloat radiusRadius 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.
public final SoMFFloat rollAngleRoll 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.
public final SoMFFloat rollSpeedSpeed 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.
public final SoMFBool keepRollAngleIndicates 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.
public final SoMFRotation headRotationThe 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.
public final SoSFFloat alphaThe value on which the interpolation is made. It must between 0.0 and 1.0.
public final SoSFBool loopIf 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:
public final SoSFBool useHeadRotationOnly
public final SoEngineOutput position
public final SoEngineOutput orientation