Time component - extensions

Contents:

1. TimeSensor.fractionIncreasing field

This feature is available since Castle Game Engine 6.5 and view3dscene 3.19.0. It's not yet available in stable CGE or view3dscene.

As an extension, we add a fractionIncreasing field to the TimeSensor node:

TimeSensor {
  ...
  SFBool     [in,out]      fractionIncreasing  TRUE      
}

When FALSE, the animation runs backwards. It's very simple: after calculating the fraction value, following the X3D specification, we do fraction := 1 - fraction. And then we send fraction through the TimeSensor.fraction_changed event.

If your interpolators react nicely to the TimeSensor.fraction_changed then the animation will run backwards. See a description how TimeSensor and interpolators are typically connected to implement animation.

Note that everything else works as usual, regardless of the fractionIncreasing value. In particular, TimeSensor.elapsedTime and TimeSensor.time output events are always generated with increasing values (trying to force them to go backward would make weird results).