The Actor class must be imported before any loading or manipulation of actors.
from direct.actor import Actor
|
Once the module is loaded, the actor object must be constructed, and the model and animations must be loaded:
nodePath = Actor.Actor()
nodePath.loadModel(‘Model Path’>
nodePath.loadAnims({‘Arbitrary Name1’:’Animation Path 1’})
nodePath.loadAnims({‘Arbitrary Name2’:’Animation Path 2’})
|
Loading each animation requires a tuple: the name one is giving the animation and the path to the animation. This entire process can be shortened to a single command:
nodePath = Actor.Actor('Model Path', {
'Animation Name 1':'Animation Path 1',
'Animation Name 2':'Animation Path 2',
})
|
Animations may also be unloaded using the same tuple used in creating them.
nodePath.unloadAnims({'Animation Name':'Animation Path'})
|
Although this is a rarely-used technique, it is possible to assemble a
character model out of several separate pieces (separate models). This is further explained in the section Multi-Part Actors.
|