Animation Drivers

From FreeSpace Wiki
Revision as of 18:27, 9 December 2023 by Lafiel (talk | contribs) (Created page with "{{Table240| This page details how <tt>$Driven Animations:</tt> segments are parsed when encountered. }} Animation driver allow for pegging animations to certain properties of...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
FS2 Open, 24.0:

This page details how $Driven Animations: segments are parsed when encountered.

Animation driver allow for pegging animations to certain properties of the ship. Some examples it allows would be an animation whose speed is proportional to the ship speed. Or an animation that is animating over the ETS value instead of time. Basically anything where something of the ship will influence how the animation works.

Possible Driver Sources

The following are valid depending on which type of thing this animation is running. Note that stuff like a ship is also an object, so a ship would be able to use both ship and object driver sources.

Ships

  • ETSShield: The current ETS value of the shields.
    • Value range: 0 to 12
  • ETSEngine: The current ETS value of the engine.
    • Value range: 0 to 12
  • ETSWeapons: The current ETS value of the weapons.
    • Value range: 0 to 12

Objects

  • Speed: The current total speed of the object.
    • Unit: m/s
  • SpeedForward: The current speed of an object in the direction it is facing.
    • Unit: m/s
  • Pitch: The pitch of the object
    • Unit: radians
  • Bank: The bank of the object
    • Unit: radians
  • Heading: The heading of the object
    • Unit: radians

Anything

  • Random: Must be followed by two numbers, indicating the range of the random number.
    • The random generated will be identical for each combination of driver + object. I.e. if this driver set affects two animations, both will get the same random number when invoked on one object. On a different object however, they'll have a different shared random number.
    • Usage: Random 0 5 will produce a random number between 0 and 5

Possible Driver Targets

  • Speed: A multiplier for the speed at which an animation runs. Has no effect on animations with +Time Remap
  • Time: Will set the current time of the animation. Only use this for Startup Drivers. Chances are that you want +Time Remap instead otherwise.

Parsing (+Driver Set:)

  • Each Driver set specifies one way of how animations are coupled with the ship and a list of animations to be driven with this set of drivers.
  • Can be repeated as needed.

+Time Remap:

  • Optional
  • This type of driver will make the affected animations not run with time, but with the specified driver source. Will cap at the maximum "time" value of the animation.
  • Example: If you have an animation that is a rotation tabled for 20 seconds, and you specify a time remap driver for forward speed, then the rotation will be completely performed when the ship is at 20 speed or above, and will be completely unrotated again if the ship is on speed 0 again.

+Source:

+Curve:

  • Optional, but will be sensible in the vast majority of cases.
  • Specifies a curve in order to convert from whatever unit the source is in to the desired time equivalent. Identity function if not set.
  • Syntax: Name, as specified in Curves.tbl

+Property Driver:

  • Optional
  • This type of driver will continually change the target property before evaluating the animation. You can have more than one and can repeat this as needed within any Driver Set
  • Example: If you have an animation whose speed should be proportional to a value of the ship such as the ship's speed, use this type of driver.

+Source:

+Curve:

  • Optional, but will be needed almost always for a sensible result.
  • Specifies a curve in order to convert from whatever unit the source is in to the unit of the desired target. Identity function if not set.
  • Syntax: Name, as specified in Curves.tbl

+Target:

+Startup Driver:

  • Optional
  • Equivalent to the property driver, but will only be evaluated each time the animation starts from 0. You can have more than one and can repeat this as needed within any Driver Set
  • Example: If you have an animation whose speed should be proportional to a value of the ship such as the ship's speed, but not change while it is running, use this type of driver.

+Source:

+Curve:

  • Optional, but will be needed almost always for a sensible result.
  • Specifies a curve in order to convert from whatever unit the source is in to the unit of the desired target. Identity function if not set.
  • Syntax: Name, as specified in Curves.tbl

+Target:

+Affected Animations

  • The list of animations that are driven by this property driver. Make sure to not include one animation in multiple driver sets or in the list of normal animations.
  • Syntax: ( "String" "String" ), names of the animations for this ship, as defined in the Animation.tbl
    • Example: ( "wingflap" "docksequence" )