Simple example using a skeleton together with a morph animation.
Following references were helpful:
panda3d.cvs.sourceforge.net/pand … iew=markup
ripple.egg.pz included in the Panda3D release.
Save the snippet to the file “cube.egg”
Start the animation with “pview -a cube.egg”
<CoordinateSystem> { Z-up }
<Group> MyGroup {
<Dart> { 1 }
<VertexPool> MyVertexPool {
<Vertex> 0 { 1.0 1.0 -1.0
<Dxyz> MyTarget { -1.0 -1.0 1.0 }
}
<Vertex> 1 { 1.0 -1.0 -1.0
<Dxyz> MyTarget { -1.0 1.0 1.0 }
}
<Vertex> 2 { -1.0 -1.0 -1.0
<Dxyz> MyTarget { 1.0 1.0 1.0 }
}
<Vertex> 3 { -1.0 1.0 -1.0
<Dxyz> MyTarget { 1.0 -1.0 1.0 }
}
<Vertex> 4 { 1.0 1.0 1.0
<Dxyz> MyTarget { -1.0 -1.0 -1.0 }
}
<Vertex> 5 { -1.0 1.0 1.0
<Dxyz> MyTarget { 1.0 -1.0 -1.0 }
}
<Vertex> 6 { -1.0 -1.0 1.0
<Dxyz> MyTarget { 1.0 1.0 -1.0 }
}
<Vertex> 7 { 1.0 -1.0 1.0
<Dxyz> MyTarget { -1.0 1.0 -1.0 }
}
<Vertex> 8 { 1.0 1.0 -1.0
<Dxyz> MyTarget { -1.0 -1.0 1.0 }
}
<Vertex> 9 { 1.0 1.0 1.0
<Dxyz> MyTarget { -1.0 -1.0 -1.0 }
}
<Vertex> 10 { 1.0 -1.0 1.0
<Dxyz> MyTarget { -1.0 1.0 -1.0 }
}
<Vertex> 11 { 1.0 -1.0 -1.0
<Dxyz> MyTarget { -1.0 1.0 1.0 }
}
<Vertex> 12 { 1.0 -1.0 -1.0
<Dxyz> MyTarget { -1.0 1.0 1.0 }
}
<Vertex> 13 { 1.0 -1.0 1.0
<Dxyz> MyTarget { -1.0 1.0 -1.0 }
}
<Vertex> 14 { -1.0 -1.0 1.0
<Dxyz> MyTarget { 1.0 1.0 -1.0 }
}
<Vertex> 15 { -1.0 -1.0 -1.0
<Dxyz> MyTarget { 1.0 1.0 1.0 }
}
<Vertex> 16 { -1.0 -1.0 -1.0
<Dxyz> MyTarget { 1.0 1.0 1.0 }
}
<Vertex> 17 { -1.0 -1.0 1.0
<Dxyz> MyTarget { 1.0 1.0 -1.0 }
}
<Vertex> 18 { -1.0 1.0 1.0
<Dxyz> MyTarget { 1.0 -1.0 -1.0 }
}
<Vertex> 19 { -1.0 1.0 -1.0
<Dxyz> MyTarget { 1.0 -1.0 1.0 }
}
<Vertex> 20 { 1.0 1.0 1.0
<Dxyz> MyTarget { -1.0 -1.0 -1.0 }
}
<Vertex> 21 { 1.0 1.0 -1.0
<Dxyz> MyTarget { -1.0 -1.0 1.0 }
}
<Vertex> 22 { -1.0 1.0 -1.0
<Dxyz> MyTarget { 1.0 -1.0 1.0 }
}
<Vertex> 23 { -1.0 1.0 1.0
<Dxyz> MyTarget { 1.0 -1.0 -1.0 }
}
}
<Polygon> {
<Normal> { 0.0 0.0 -1.0 }
<VertexRef> { 0 1 2 3 <Ref> { MyVertexPool } }
}
<Polygon> {
<Normal> { 0.0 0.0 1.0 }
<VertexRef> { 4 5 6 7 <Ref> { MyVertexPool } }
}
<Polygon> {
<Normal> { 1.0 0.0 0.0 }
<VertexRef> { 8 9 10 11 <Ref> { MyVertexPool } }
}
<Polygon> {
<Normal> { 0.0 -1.0 0.0 }
<VertexRef> { 12 13 14 15 <Ref> { MyVertexPool } }
}
<Polygon> {
<Normal> { -1.0 0.0 0.0 }
<VertexRef> { 16 17 18 19 <Ref> { MyVertexPool } }
}
<Polygon> {
<Normal> { 0.0 1.0 0.0 }
<VertexRef> { 20 21 22 23 <Ref> { MyVertexPool } }
}
<Joint> MyJoint {
<Transform> {
<Matrix4> {
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
}
}
<VertexRef> {
0 1 2 3 4 5 6 7 8 9 10 11 12
13 14 15 16 17 18 19 20 21 22 23
<Scalar> membership { 1.0 }
<Ref> { MyVertexPool }
}
}
}
<Table> {
<Bundle> MyGroup {
<Table> morph {
<S$Anim> MyTarget {
<Scalar> fps { 5 }
<V> {
0.0
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
1.0
0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1
0.0
}
}
}
<Table> <skeleton> {
<Table> MyJoint {
<Xfm$Anim> xform {
<Scalar> fps { 5 }
<Scalar> order { t }
<Scalar> contents { z }
<V> {
0.0
1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0
10.0
9.0 8.0 7.0 6.0 5.0 4.0 3.0 2.0 1.0
0.0
}
}
}
}
}
}
- Every string that is prefixed with My in this example you can modify.
- You can include more than one animation in one egg file. Advantage: You don’t have to define animations when you load an actor.
- pview is only able to play an animation if group name = bundle name (if the animation is not in a separate file).
- The Python Actor class is able to play any animation inside one egg file. Use: actor.loop(“MyBundleName”).
- “” is a keyword (see characterMaker.cxx)
- “xform” is a keyword (see e.g. animBundleMaker.cxx)
- “morph” is a keyword (see characterMaker.cxx)
- Python Actors have a method animPanel which may be helpful.
€: David has fixed everything I was ranting about.