Difference between revisions of "Animation Code"

From FreeSpace Wiki
Jump to: navigation, search
m (update)
Line 1: Line 1:
 +
Revision information.. '''''Ship.cpp''''' <!-- Please update this information when page is updated -->
 +
::'''3.6.x branch:''' 2.336.2.73
 +
::'''3.7 branch:''' 2.427
 +
 +
 
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 [[Animation_Code#Setting_Turret_Angle|multipart turrets]]
 
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 [[Animation_Code#Setting_Turret_Angle|multipart turrets]]
  
==Animation Class==
+
 
*Animation classes are defined in submodels description
+
==$Animation:==
*Syntax: '''$animation:''' ''Class''
+
{{Table36|*Animation classes are defined in submodels description
*'''Triggered'''
+
*Syntax: '''String''', animation ''class''
**Currently only supported animation class
+
*'''Available animation types:'''
 +
**Triggered}}
 +
 
  
 
===Animation Type===
 
===Animation Type===
 +
{{Table36|
 
*Animation type defines when the animation is used
 
*Animation type defines when the animation is used
 
*Currently supported animation types:
 
*Currently supported animation types:
Line 28: Line 36:
 
**'''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]])
*Syntax: '''$type:''' ''Type''
+
*Syntax: '''$type:''' ''Type''}}
 +
 
  
 
===Animation Sub-Type===
 
===Animation Sub-Type===
 +
{{Table36|
 
*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 = 1st weapon bank, 1 = 2nd weapon bank, etc.)
 
**Syntax: '''+sub_type:''' ''Value'', (0 = 1st weapon bank, 1 = 2nd weapon bank, etc.)
 
*'''turret firing'''
 
*'''turret firing'''
**Syntax: '''+sub_type:''' ''Value'', (model number of the turret that triggers the animation)
+
**Syntax: '''+sub_type:''' ''Value'', (model number of the turret that triggers the animation)}}
 +
 
  
 
===Animation Code===
 
===Animation Code===
 +
 +
 +
====Initial type====
 +
{{Table36|
 +
*'''+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. 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====
 +
{{Table36|
 
*'''+delay:'''
 
*'''+delay:'''
 
**Defines how long til the trigger starts.
 
**Defines how long til the trigger starts.
**Syntax: ''Value'', (milliseconds)
+
**Syntax: '''Integer''', milliseconds
*'''+reverse delay:'''
+
*'''+reverse_delay:'''
**
+
**Defines how long til the trigger starts.
**Syntax: ''Value'', (seconds)
+
**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: ''Value,Value,Value'', (degrees)
+
**Syntax: '''Vector''', three ''floats'' in degrees, x, y, z respectively
 +
**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. Defined with x, y and z floats.
**Syntax: ''Value,Value,Value'', (meters)
+
**Syntax: '''Vector''', three ''floats'', x, y, z respectively
 
*'''+acceleration:'''
 
*'''+acceleration:'''
 
**Defeines acceleration speed of subobject rotation. Defined with three floats, x, y and z
 
**Defeines acceleration speed of subobject rotation. Defined with three floats, x, y and z
**Syntax: ''Value,Value,Value''
+
**Syntax: '''Vector''', three ''floats'', x, y, z respectively
 
*'''+time:'''
 
*'''+time:'''
 
**Defines time for object to rotate, move, whatever.  
 
**Defines time for object to rotate, move, whatever.  
**Syntax: ''Value'', (milliseconds)
+
**Syntax: '''Integer''', milliseconds
 
*'''$Sound:''' (Does not work with 'initial' animations)
 
*'''$Sound:''' (Does not work with 'initial' animations)
 
**Defines sounds that are played with the animation
 
**Defines sounds that are played with the animation
 
**'''+Start:'''
 
**'''+Start:'''
 
***Defines the sound that is played when animation starts
 
***Defines the sound that is played when animation starts
***Syntax: ????
+
***Syntax: '''Integer'''
 
**'''+Loop:'''
 
**'''+Loop:'''
 
***Defines the sound that is played when animation is going on
 
***Defines the sound that is played when animation is going on
***Syntax: ????
+
***Syntax: '''Integer'''
 
**'''+End:'''
 
**'''+End:'''
 
***Defines the sound that is played when animation stops
 
***Defines the sound that is played when animation stops
***Syntax: ????
+
***Syntax: '''Integer'''
 
**'''+Radius:'''
 
**'''+Radius:'''
 
***Defines the distance from the submodel where the sound is audible
 
***Defines the distance from the submodel where the sound is audible
***Syntax: ''Value'', (meters)
+
***Syntax: '''Float''', meters}}
 +
 
  
 
==Animation Examples==
 
==Animation Examples==
 +
 +
 
===Setting Turret Angle===
 
===Setting Turret Angle===
 
*Animation code can be used to set multipart turrets barrel angle at the beginning of the mission
 
*Animation code can be used to set multipart turrets barrel angle at the beginning of the mission
Line 84: Line 123:
 
***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 to forward directin the second value has to be set to 180.
 
***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 to forward directin the second value has to be set to 180.
 
   
 
   
 +
 
====Example====
 
====Example====
  $Subsystem:            turret02,0.833,1.0
+
 
  $Default PBanks:      (  "Terran Turret" )
+
<pre>
  $animation: triggered
+
$Subsystem:            turret02,0.833,1.0
  $type: initial
+
$Default PBanks:      (  "Terran Turret" )
 +
$animation: triggered
 +
$type: initial
 
   +relative_angle:      90,180,0
 
   +relative_angle:      90,180,0
 +
</pre>
  
  
 
[[Category:Tables]]
 
[[Category:Tables]]

Revision as of 12:18, 9 August 2007

Revision information.. Ship.cpp

3.6.x branch: 2.336.2.73
3.7 branch: 2.427


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


$Animation:

FS2 Open, 3.6.x: *Animation classes are defined in submodels description
  • Syntax: String, animation class
  • Available animation types:
    • Triggered


Animation Type

FS2 Open, 3.6.x:
  • 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)
    • door
      • Animation code starts when ship launches or retrives others through it's 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)
  • Syntax: $type: Type


Animation Sub-Type

FS2 Open, 3.6.x: {{{1}}}


Animation Code

Initial type

FS2 Open, 3.6.x:
  • +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. 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.x:
  • +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. 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
  • $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 to forward directin the second value has to be set to 180.


Example

$Subsystem:            turret02,0.833,1.0
$Default PBanks:       (  "Terran Turret" )
$animation: triggered
$type: initial
   +relative_angle:       90,180,0