So for some reason no matter what I try the animations never play. Even though when I open pview they play perfectly.
Here’s some code I use to try to run it:
import sys, os, math, random
from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
import mainMenu
class mainCtrl(ShowBase):
def __init__(self):
ShowBase.__init__(self)
#base.disableMouse( )
# create a lens
self.lens = base.camLens
# set the field of view to 90 degrees
self.lens.setFov( 10 )
# set the far clip plane
self.lens.setFar( 90000 )
myobj = Actor('models/testxcc2.egg',
{"character": "models/testxcc2"})
myobj.reparentTo(render)
myobj.loop('character')
startGame = mainCtrl()
startGame.run()
and here is the code for the egg file (sorry if it’s long) so you can just paste instead of downloading a file…
<CoordinateSystem> { Z-Up }
<Group> character {
<Dart> { 1 }
<Group> Box01 {
<VertexPool> Box01.verts {
<Vertex> 0 {
-46.8576 1.27026 0
<Normal> { 0 0 -1 }
// Bone02:1
}
<Vertex> 1 {
-25.4224 30.5648 0
<Normal> { 0 0 -1 }
// Bone02:1
}
<Vertex> 2 {
0.23267 11.7927 0
<Normal> { 0 0 -1 }
// Bone02:1
}
<Vertex> 3 {
-9.78186 -20.9192 0
<Normal> { 0 0 -1 }
// Bone01:1
}
<Vertex> 4 {
-46.8576 1.27026 12.3432
<Normal> { 0 0 1 }
// Bone02:1
}
<Vertex> 5 {
-9.78186 -20.9192 12.3432
<Normal> { 0 0 1 }
// Bone01:1
}
<Vertex> 6 {
0.23267 11.7927 12.3432
<Normal> { 0 0 1 }
// Bone02:1
}
<Vertex> 7 {
-25.4224 30.5648 12.3432
<Normal> { 0 0 1 }
// Bone02:1
}
<Vertex> 8 {
-46.8576 1.27026 0
<Normal> { -0.513544 -0.858063 0 }
// Bone02:1
}
<Vertex> 9 {
-9.78186 -20.9192 0
<Normal> { -0.513544 -0.858063 0 }
// Bone01:1
}
<Vertex> 10 {
-9.78186 -20.9192 12.3432
<Normal> { -0.513544 -0.858063 0 }
// Bone01:1
}
<Vertex> 11 {
-46.8576 1.27026 12.3432
<Normal> { -0.513544 -0.858063 0 }
// Bone02:1
}
<Vertex> 12 {
-9.78186 -20.9192 0
<Normal> { 0.956194 -0.292733 0 }
// Bone01:1
}
<Vertex> 13 {
0.23267 11.7927 0
<Normal> { 0.956194 -0.292733 0 }
// Bone02:1
}
<Vertex> 14 {
0.23267 11.7927 12.3432
<Normal> { 0.956194 -0.292733 0 }
// Bone02:1
}
<Vertex> 15 {
-9.78186 -20.9192 12.3432
<Normal> { 0.956194 -0.292733 0 }
// Bone01:1
}
<Vertex> 16 {
0.23267 11.7927 0
<Normal> { 0.590512 0.807029 0 }
// Bone02:1
}
<Vertex> 17 {
-25.4224 30.5648 0
<Normal> { 0.590512 0.807029 0 }
// Bone02:1
}
<Vertex> 18 {
-25.4224 30.5648 12.3432
<Normal> { 0.590512 0.807029 0 }
// Bone02:1
}
<Vertex> 19 {
0.23267 11.7927 12.3432
<Normal> { 0.590512 0.807029 0 }
// Bone02:1
}
<Vertex> 20 {
-25.4224 30.5648 0
<Normal> { -0.807029 0.590512 0 }
// Bone02:1
}
<Vertex> 21 {
-46.8576 1.27026 0
<Normal> { -0.807029 0.590512 0 }
// Bone02:1
}
<Vertex> 22 {
-46.8576 1.27026 12.3432
<Normal> { -0.807029 0.590512 0 }
// Bone02:1
}
<Vertex> 23 {
-25.4224 30.5648 12.3432
<Normal> { -0.807029 0.590512 0 }
// Bone02:1
}
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 0 1 2 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 2 3 0 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 4 5 6 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 6 7 4 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 8 9 10 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 10 11 8 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 12 13 14 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 14 15 12 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 16 17 18 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 18 19 16 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 20 21 22 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<VertexRef> { 22 23 20 <Ref> { Box01.verts } }
}
}
<Joint> Bone01 {
<Transform> {
<Matrix4> {
-0.498809 0.866712 0 0
-0.866712 -0.498809 0 0
0 0 1 0
8.98265 -35.1776 0 1
}
}
<Joint> Bone02 {
<Transform> {
<Matrix4> {
0.999416 0.0341694 0 0
-0.0341694 0.999416 0 0
0 0 1 0
38.584 2.94417e-007 0 1
}
}
<Joint> Bone03 {
<Transform> {
<Matrix4> {
1 -1.91348e-008 0 0
1.91348e-008 1 0 0
0 0 1 0
41.6833 -5.58898e-006 0 1
}
}
}
<VertexRef> {
0 1 2 4 6 7 8 11 13 14 16 17 18 19 20 21 22 23
<Ref> { Box01.verts }
}
}
<VertexRef> {
3 5 9 10 12 15
<Ref> { Box01.verts }
}
}
}
<Table> {
<Bundle> character {
<Table> "<skeleton>" {
<Table> Bone01 {
<Xfm$Anim_S$> xform {
<Scalar> fps { 30 }
<Char*> order { srpht }
<S$Anim> h { <V> { 119.921 } }
<S$Anim> x { <V> { 8.98265 } }
<S$Anim> y { <V> { -35.1776 } }
}
<Table> Bone02 {
<Xfm$Anim_S$> xform {
<Scalar> fps { 30 }
<Char*> order { srpht }
<S$Anim> h {
<V> {
1.95814 3.8901 9.45159 18.3683 30.0363 43.1945 55.8751
65.7232 73.2903 80.6057 87.7188 94.3452 99.5457 101.72
99.1364 92.4884 83.3299 73.0726 63.0024 54.3221 48.2124
45.8916 45.8916 45.8916 45.8916 45.8916 45.8916 45.8916
45.8916 45.8916 45.8916
}
}
<S$Anim> p {
<V> {
0 1.49251 5.3215 10.4363 15.7088 20.1209 22.9992 24.0209
22.9453 19.9323 15.3226 9.77385 4.2874 0 -3.37132
-6.69389 -9.73672 -12.2999 -14.2589 -15.5865 -16.335
-16.5768 -16.5768 -16.5768 -16.5768 -16.5768 -16.5768
-16.5768 -16.5768 -16.5768 -16.5768
}
}
<S$Anim> r {
<V> {
-0 -1.44562 -5.19451 -10.4427 -16.4513 -22.3467 -26.9347
-28.7804 -27.0154 -22.5706 -16.7377 -10.5715 -4.79955 -0
4.50486 9.60144 14.9841 20.3154 25.2098 29.2416 31.9713
32.9719 32.9719 32.9719 32.9719 32.9719 32.9719 32.9719
32.9719 32.9719 32.9719
}
}
<S$Anim> x { <V> { 38.584 } }
}
<Table> Bone03 {
<Xfm$Anim_S$> xform {
<Scalar> fps { 30 }
<Char*> order { srpht }
<S$Anim> x { <V> { 41.6833 } }
}
}
}
}
}
}
}
I followed the manual, and it seems like even though I export with animations and model separate, or with them combined (“both”) I can’t ever get the animation to play.
I even tried myobj.pprint() and it says the frames and the animation speed, but it also says “File: None”. I think I’m thoroughly confused and I can’t even start working on my game until i figure out this animation problem. Thanks for any and all help.