Difference between revisions of "Animation Code"

From FreeSpace Wiki
Jump to: navigation, search
(added a note + link to Subsystem article)
m ($Animation:: assuming there's a formatting error here)
 
(9 intermediate revisions by 5 users not shown)
Line 4: Line 4:
  
 
==Important Note: "$triggered:" Subobject Property==
 
==Important Note: "$triggered:" Subobject Property==
For any animated subobject other than turrets, you must have "$triggered:" written in the subobject properties field of that subobject for the model file (POF) that you wish to animate. See [Subsystem] for more information on Subsystem flags and options.
+
For any animated subobject other than turrets, you must have "$triggered:" written in the subobject properties field of that subobject for the model file (POF) that you wish to animate. See [[Subsystem]] for more information on Subsystem flags and options.
  
 
==$Animation:==
 
==$Animation:==
{{Table3610|*Animation classes are defined in submodels description
+
{{Table3610|
 +
*Animation classes are defined in submodels description
 
*Syntax: '''String''', animation ''class''
 
*Syntax: '''String''', animation ''class''
 
*'''Available animation types:'''
 
*'''Available animation types:'''
Line 23: Line 24:
 
**'''docked'''
 
**'''docked'''
 
***Animation code is started when ship is docked
 
***Animation code is started when ship is docked
**'''primary_bank'''
+
**'''primary-bank'''
 
***Animation code is started when a primary bank is selected (armed)
 
***Animation code is started when a primary bank is selected (armed)
**'''secondary_bank'''
+
**'''secondary-bank'''
 
***Animation code is started when a secondary bank is selected (armed)
 
***Animation code is started when a secondary bank is selected (armed)
**'''door'''
+
**'''fighterbay'''
***Animation code starts when ship launches or retrives others through it's fighterbay.
+
***Animation code starts when ship launches from or receives others through its fighterbay
 
**'''afterburner'''
 
**'''afterburner'''
 
***Animation code is started when ships afterburner is engaged
 
***Animation code is started when ships afterburner is engaged
**'''turret firing'''
+
**'''turret-firing'''
 
***Animation code is started when selected turret is firing
 
***Animation code is started when selected turret is firing
 
**'''scripted'''
 
**'''scripted'''
 
***Animation code is started when it is triggered with scripts (see [[scripting.tbl]])
 
***Animation code is started when it is triggered with scripts (see [[scripting.tbl]])
 +
{{Table3615|
 +
*'''turret-fired'''
 +
**Animation code is started whenever a turret has fired (Useful for recoil or similar things)}}
 
*Syntax: '''$type:''' ''Type''}}
 
*Syntax: '''$type:''' ''Type''}}
 
  
 
===Animation Sub-Type===
 
===Animation Sub-Type===
 
{{Table3610|
 
{{Table3610|
 
*Optional more accurate descriptor for the animation type
 
*Optional more accurate descriptor for the animation type
*'''primary bank''' or '''secondary bank'''
+
*'''primary-bank''' or '''secondary-bank'''
 
**Syntax: '''+sub_type:''' ''Value'', 0 is the 1st weapon bank, 1 is the 2nd weapon bank, etc.
 
**Syntax: '''+sub_type:''' ''Value'', 0 is the 1st weapon bank, 1 is the 2nd weapon bank, etc.
*'''turret firing'''
+
*'''turret-firing'''
 
**Syntax: '''+sub_type:''' ''Value'', model number of the turret that triggers the animation. NOTE: This feature currently does not work on multipart turrets.
 
**Syntax: '''+sub_type:''' ''Value'', model number of the turret that triggers the animation. NOTE: This feature currently does not work on multipart turrets.
 +
{{Table371|
 +
*'''fighterbay'''
 +
**Syntax: '''+sub_type:''' ''Value'', number of the bay path that must be used for this animation to trigger. A negative can be used to allow the animation to trigger only when the path is '''not''' used. The number of a bay path is the number in its name; for example, use 3 to restrict the animation to the path $bay03, or -1 to prevent it from triggering when the path $bay01 is used.}}
 
}}
 
}}
 
  
 
===Animation Code===
 
===Animation Code===
Line 58: Line 63:
 
*'''+reverse_delay:'''
 
*'''+reverse_delay:'''
 
**Syntax: '''Integer'''
 
**Syntax: '''Integer'''
*'''+absolute angle:''' OR '''+relative angle:'''
+
*'''+absolute_angle:''' OR '''+relative_angle:'''
 
**Defines the rotation degrees with three floats that give the x, y, and z. Absolute means in world terms; relative means relative to the ship. So a 90 degree angle on the ship would always be straight up in relative degrees; it would vary depending how the ship was rotated in absolute degrees.
 
**Defines the rotation degrees with three floats that give the x, y, and z. Absolute means in world terms; relative means relative to the ship. So a 90 degree angle on the ship would always be straight up in relative degrees; it would vary depending how the ship was rotated in absolute degrees.
 
**Syntax: '''Vector''', three ''floats'' in degrees, x, y, z respectively
 
**Syntax: '''Vector''', three ''floats'' in degrees, x, y, z respectively
Line 71: Line 76:
 
**Defines time for object to rotate, move, whatever.
 
**Defines time for object to rotate, move, whatever.
 
**Syntax: '''Integer''', milliseconds}}
 
**Syntax: '''Integer''', milliseconds}}
 
  
 
====Other types====
 
====Other types====
Line 81: Line 85:
 
**Defines how long til the trigger starts.
 
**Defines how long til the trigger starts.
 
**Syntax: '''Integer''', milliseconds
 
**Syntax: '''Integer''', milliseconds
*'''+absolute angle:''' OR '''+relative angle:'''
+
*'''+absolute_angle:''' OR '''+relative_angle:'''
 
**Defines the rotation degrees with three floats that give the x, y, and z. Absolute means in world terms; relative means relative to the ship. So a 90 degree angle on the ship would always be straight up in relative degrees; it would vary depending how the ship was rotated in absolute degrees.
 
**Defines the rotation degrees with three floats that give the x, y, and z. Absolute means in world terms; relative means relative to the ship. So a 90 degree angle on the ship would always be straight up in relative degrees; it would vary depending how the ship was rotated in absolute degrees.
 
**Syntax: '''Vector''', three ''floats'' in degrees, x, y, z respectively
 
**Syntax: '''Vector''', three ''floats'' in degrees, x, y, z respectively
 
**Example: ''90,180,0''
 
**Example: ''90,180,0''
 
*'''+velocity:'''
 
*'''+velocity:'''
**Defines subobject rotation speed, in relative terms. Defined with x, y and z floats.
+
**Defines subobject rotation speed, in relative terms. Units are in degrees per second.  Defined with x, y and z floats.
 
**Syntax: '''Vector''', three ''floats'', x, y, z respectively
 
**Syntax: '''Vector''', three ''floats'', x, y, z respectively
 
*'''+acceleration:'''
 
*'''+acceleration:'''
**Defeines acceleration speed of subobject rotation. Defined with three floats, x, y and z
+
**Defines acceleration speed of subobject rotation. Units are in degrees per second squared.  Defined with three floats, x, y and z
 
**Syntax: '''Vector''', three ''floats'', x, y, z respectively
 
**Syntax: '''Vector''', three ''floats'', x, y, z respectively
 
*'''+time:'''
 
*'''+time:'''
**Defines time for object to rotate, move, whatever.
+
**Defines the amount of time that the object will rotate, move, whatever.
 
**Syntax: '''Integer''', milliseconds
 
**Syntax: '''Integer''', milliseconds
 
*'''$Sound:''' (Does not work with 'initial' animations)
 
*'''$Sound:''' (Does not work with 'initial' animations)
Line 108: Line 112:
 
***Defines the distance from the submodel where the sound is audible
 
***Defines the distance from the submodel where the sound is audible
 
***Syntax: '''Float''', meters}}
 
***Syntax: '''Float''', meters}}
 
  
 
==Animation Examples==
 
==Animation Examples==

Latest revision as of 02:32, 9 December 2013

Revision information.....

FSO Revision: 5211
Note: Please update the version when the page is updated. If your edit had nothing to do with new code entries then please do not edit the version


Known commonly as Bob's animation code as the code was written by Bobboau. Enables submodels defined in ships.tbl or in any related modular table to be animated in game. Animation code is included to the subsystem entry in similar manner as with multipart turrets

Important Note: "$triggered:" Subobject Property

For any animated subobject other than turrets, you must have "$triggered:" written in the subobject properties field of that subobject for the model file (POF) that you wish to animate. See Subsystem for more information on Subsystem flags and options.

$Animation:

FS2 Open 3.6.10:
  • Animation classes are defined in submodels description
  • Syntax: String, animation class
  • Available animation types:
    • Triggered


Animation Type

FS2 Open 3.6.10:
  • Animation type defines when the animation is used
  • Currently supported animation types:
    • initial
      • Animation code is started when the mission begins. Unlike other animation types this requires only angle to be set
    • docking
      • Animation code is started when ship starts docking
    • docked
      • Animation code is started when ship is docked
    • primary-bank
      • Animation code is started when a primary bank is selected (armed)
    • secondary-bank
      • Animation code is started when a secondary bank is selected (armed)
    • fighterbay
      • Animation code starts when ship launches from or receives others through its fighterbay
    • afterburner
      • Animation code is started when ships afterburner is engaged
    • turret-firing
      • Animation code is started when selected turret is firing
    • scripted
      • Animation code is started when it is triggered with scripts (see scripting.tbl)
FS2 Open, 3.6.16:
  • turret-fired
    • Animation code is started whenever a turret has fired (Useful for recoil or similar things)
  • Syntax: $type: Type
  • Animation Sub-Type

    FS2 Open 3.6.10:
    • Optional more accurate descriptor for the animation type
    • primary-bank or secondary-bank
      • Syntax: +sub_type: Value, 0 is the 1st weapon bank, 1 is the 2nd weapon bank, etc.
    • turret-firing
      • Syntax: +sub_type: Value, model number of the turret that triggers the animation. NOTE: This feature currently does not work on multipart turrets.
    FS2 Open, 3.7.2:
    • fighterbay
      • Syntax: +sub_type: Value, number of the bay path that must be used for this animation to trigger. A negative can be used to allow the animation to trigger only when the path is not used. The number of a bay path is the number in its name; for example, use 3 to restrict the animation to the path $bay03, or -1 to prevent it from triggering when the path $bay01 is used.

    Animation Code

    Initial type

    FS2 Open 3.6.10:
    • +delay:
      • Defines how long til the trigger starts.
      • Syntax: Integer, milliseconds
    • +reverse_delay:
      • Syntax: Integer
    • +absolute_angle: OR +relative_angle:
      • Defines the rotation degrees with three floats that give the x, y, and z. Absolute means in world terms; relative means relative to the ship. So a 90 degree angle on the ship would always be straight up in relative degrees; it would vary depending how the ship was rotated in absolute degrees.
      • Syntax: Vector, three floats in degrees, x, y, z respectively
      • Example: 90,180,0
    • +velocity:
      • Defines subobject rotation speed, in relative terms. Defined with x, y and z floats.
      • Syntax: Vector, three floats, x, y, z respectively
    • +acceleration:
      • Defeines acceleration speed of subobject rotation. Defined with three floats, x, y and z
      • Syntax: Vector, three floats, x, y, z respectively
    • +time:
      • Defines time for object to rotate, move, whatever.
      • Syntax: Integer, milliseconds

    Other types

    FS2 Open 3.6.10:
    • +delay:
      • Defines how long til the trigger starts.
      • Syntax: Integer, milliseconds
    • +reverse_delay:
      • Defines how long til the trigger starts.
      • Syntax: Integer, milliseconds
    • +absolute_angle: OR +relative_angle:
      • Defines the rotation degrees with three floats that give the x, y, and z. Absolute means in world terms; relative means relative to the ship. So a 90 degree angle on the ship would always be straight up in relative degrees; it would vary depending how the ship was rotated in absolute degrees.
      • Syntax: Vector, three floats in degrees, x, y, z respectively
      • Example: 90,180,0
    • +velocity:
      • Defines subobject rotation speed, in relative terms. Units are in degrees per second. Defined with x, y and z floats.
      • Syntax: Vector, three floats, x, y, z respectively
    • +acceleration:
      • Defines acceleration speed of subobject rotation. Units are in degrees per second squared. Defined with three floats, x, y and z
      • Syntax: Vector, three floats, x, y, z respectively
    • +time:
      • Defines the amount of time that the object will rotate, move, whatever.
      • Syntax: Integer, milliseconds
    • $Sound: (Does not work with 'initial' animations)
      • Defines sounds that are played with the animation
      • +Start:
        • Defines the sound that is played when animation starts
        • Syntax: Integer
      • +Loop:
        • Defines the sound that is played when animation is going on
        • Syntax: Integer
      • +End:
        • Defines the sound that is played when animation stops
        • Syntax: Integer
      • +Radius:
        • Defines the distance from the submodel where the sound is audible
        • Syntax: Float, meters

    Animation Examples

    Setting Turret Angle

    • Animation code can be used to set multipart turrets barrel angle at the beginning of the mission
    • Animation Class = triggered
      • The only one available
    • Animation Type = initial
      • As we want the barrels to align themselves at the beginning of the mission
    • Animation Code
      • +relative_angle: is good for this purpose
      • Notes about angles:
        • First value is used to determine the turret's barrels deviation from the turrets normal. So barrel elevation in degrees is ( 90 - the first value ).
        • Second value is used to determine the turret facing. With 0 the turret facing is in the normal setting and with 180 turn the turret completely around. Do note that turrets on the underside of the model normally face backwards, so to get these turrets pointing forwards the second value has to be set to 180.


    Examples

    $Subsystem:            turret02,0.833,1.0
    $Default PBanks:       (  "Terran Turret" )
    $animation: triggered
    $type: initial
       +relative_angle:       90,180,0
    
    $Subsystem: DockingClaw1, 0, 1.0
    $Flags: ( "untargetable" )
    $animation: triggered
    $type: docking                           ;;The claw opens on approach
       +sub_type:       0               ;;The number of the associated dock (works with multidocking)
       +delay:          0
       +relative_angle: 0,0,90
       +velocity:       0,0,10
       +acceleration:   0,0,5
       +time:           2000
    $animation: triggered
    $type: docked                           ;;The claw closes once docked
       +sub_type:       0
       +delay:          0
       +relative_angle: 0,0,-90
       +velocity:       0,0,10
       +acceleration:   0,0,5
       +time:           2000