Howto:Animate models: Difference between revisions

Jump to navigation Jump to search
Merged some stuff from Howto:3D Aircraft Models
(→‎Textranslate: correct step info)
(Merged some stuff from Howto:3D Aircraft Models)
Line 3: Line 3:
The real world is full of motion. To simulate this in [[FlightGear]], '''models must be animated'''.
The real world is full of motion. To simulate this in [[FlightGear]], '''models must be animated'''.


This document provides basic information for all kind of animations. For more complex animations, you are advised to check the available [[aircraft]] for examples.
FlightGear allows you to animate models in response to property changes: for example, the propellers can spin when the engine is on and the elevators can move up and down with your controller. There is no fixed limit on what parts can be animated: the only requirements are that the part is named in the 3D model file, and that there is a property in the main tree that you can use to get the positioning information.
 
This document provides basic information for all kind of animations. When animating your model, it is very helpful to find an aircraft with parts similar to yours and use it as an example. Cut and paste the code into your wrapper file and then edit to suit.


== A note about animation order ==
== A note about animation order ==
Line 11: Line 13:
{{Main article|AC files: Understanding and changing .ac code#Identifying an object}}
{{Main article|AC files: Understanding and changing .ac code#Identifying an object}}


When referring to an .ac file in your xml animation, it is important that the <object name> matches the object named in the .ac file. For example, when exporting to AC3D in Sketchup, the .ac file will name the objects in your model to "blah" by default. You need to amend the relevant object names in your .ac file using text edit, so that the xml will work.
When referring to an .ac file in your xml animation, it is important that the <code><object name></code> exactly matches the object named in the .ac file (this includes cases!).  
 
'''Note for SketchUp users:''' when exporting to AC3D in Sketchup, the .ac file will name the objects in your model to "blah" by default. You need to amend the relevant object names in your .ac file using text edit, so that the xml will work.


== Special code parts ==
== Special code parts ==
Line 181: Line 185:
=== Object-name ===
=== Object-name ===
These names are set in the 3D model. Each single object has a unique name; for easy identification it is advised to use descriptive names (LeftElevator, Rudder etc.). Animations are only applied to those objects that are mentioned in an object-name line (one object per line!). Animations lacking those, will be applied to the entire model.
These names are set in the 3D model. Each single object has a unique name; for easy identification it is advised to use descriptive names (LeftElevator, Rudder etc.). Animations are only applied to those objects that are mentioned in an object-name line (one object per line!). Animations lacking those, will be applied to the entire model.
=== Property ===
Each animation must be associated with exactly one property from the main FlightGear property tree (remember that the properties in the wrapper file are not part of the main tree), using <code><property></code> to provide the property path:
<source>
<animation>
  <type>rotate</type>
  <object-name>Rudder</object-name>
  <property>controls/rudder</property>
</animation>
</source>
Note the omission of the leading slash '/' when reffering to the property. This assures that when the model is used for AI or multiplayer traffic the animations will follow that of the AI controller instead of that of the user.


== Animation types ==
== Animation types ==

Navigation menu