In this recipe we will see how to move a model along a line, typically referred to as a path, stored in Panda3D's model format. This can come in very handy for setting paths of non-player characters inside a level. Another common use of this is to attach the camera to a path and make it fly through the game world smoothly.
To follow this recipe you first have to set up a project as described in Setting up the game structure. In addition, you need to create a curve in Maya or Blender and export it to Panda3D's .egg
file format. In case you don't have these tools or do not know how to work with them, here's a sample curve you can paste into a text editor and save it as path.egg
:
<CoordinateSystem> { Z-up } <Group> Curve { <VertexPool> Curve { <Vertex> 0 { -2.66117048264 -0.964361846447 0.0 1.0 } <Vertex> 1 { 1.8930850029 -0.948404431343 0.0 1.0 } <Vertex> 2 { 10.3484048843...