| 1 | # Animate Transform By Code |
| 2 | |
| 3 | Example how to animate (change, modify) the model using ObjectPascal code. |
| 4 | Makes a trivial animation by changing TTransformNode.Translation values |
| 5 | in each Update. |
| 6 | You can rotate/move the scene by dragging with mouse. |
| 7 | |
| 8 | Generally, you can just change the nodes graph (in Scene.RootNode) |
| 9 | however you like, whenever you like. TX3DNode class has a lot of methods |
| 10 | to find and change nodes within the graph, you can insert/delete/change |
| 11 | any of their children nodes, fields, and generally do everything. |
| 12 | |
| 13 | Of course, in case of such trivial animation as in this program, we could |
| 14 | also express it directly in the model (X3D or glTF, designed in Blender) |
| 15 | and just load the scene, and call MainScene.PlayAnimation. |
| 16 | This would make the scene animate, without the need for any ObjectPascal code to do this. |
| 17 | |
| 18 | Using [Castle Game Engine](https://castle-engine.io/). |
| 19 | |
| 20 | ## Building |
| 21 | |
| 22 | Compile by: |
| 23 | |
| 24 | - [CGE editor](https://castle-engine.io/editor). Just use menu items _"Compile"_ or _"Compile And Run"_. |
| 25 | |
| 26 | - Or use [CGE command-line build tool](https://castle-engine.io/build_tool). Run `castle-engine compile` in this directory. |
| 27 | |
| 28 | - Or use [Lazarus](https://www.lazarus-ide.org/). Open in Lazarus `animate_transform_by_code_standalone.lpi` file and compile / run from Lazarus. Make sure to first register [CGE Lazarus packages](https://castle-engine.io/lazarus). |
| 29 | |
| 30 | - Or use [Delphi](https://www.embarcadero.com/products/Delphi). Open in Delphi `animate_transform_by_code_standalone.dproj` file and compile / run from Delphi. See [CGE and Delphi](https://castle-engine.io/delphi) documentation for details. |