problem whit the animations

I have a problem whit the animations:

import direct.directbase.DirectStart
from direct.task import Task 
from direct.actor import Actor
from pandac.PandaModules import * 
import math
import libpanda
from direct.actor.Actor import Actor

import direct.directbase.DirectStart
from pandac.PandaModules import AmbientLight,DirectionalLight
from pandac.PandaModules import LightAttrib
from pandac.PandaModules import TextNode
from pandac.PandaModules import Vec3,Vec4
from direct.showbase.DirectObject import DirectObject
from direct.gui.OnscreenText import OnscreenText
from direct.interval.MetaInterval import Sequence
from direct.interval.FunctionInterval import Func,Wait
from direct.actor import Actor
from random import random
import sys

#Load the first environment mode
environ = loader.loadModel("models/ssw1.egg")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(0,0,0)

#Load the first environment mode
environ = loader.loadModel("models/rr2.egg")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(0,0,0)

#base.disableMouse()


ssw1 = loader.loadModel("models/ssw1.egg")

player = ssw1 

dummy=render.attachNewNode("models/ssw1.egg") 
base.camera.reparentTo(dummy) 
dummy.setPos(0,30,0) # 10 = distance between cam and point 
dummy.setH(0) #this will rotate it 60 degrees around the point

base.cam.lookAt(ssw1)

self.robot2 = Actor.Actor('models/re',
      {'leftPunch' : 'models/rere'})
self.robot2.setPosHprScale(1,1.5,4,225,0,0,1.25,1.25,1.25)
self.robot2.setColor(Vec4(.7,0,0,1))
self.robot2.reparentTo(render)
run()

and the error:Could not load the model:“model/re”

Do you have a file call re.egg in your models directory? If you don’t, that’s what the error message is complaining about.

David

No I have.But I thing that I need to make it egg.pz.

No. Panda can load egg files and egg.pz files equally well.

There must be more of the error message. What else does it say? It will tell you whether the problem is that it can’t find the file in the first place, or whether there is something wrong with the file.

David

Yes.It is write that the program could not find the path to the model.But I check it.

What does it say exactly? It also lists the directory names it is looking on.

David

Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:loader(error): Couldn’t load file models/re.egg: not found on model path (curre
ntly: “/c/Program Files/panda/pnd/game1;/c/Program Files/panda/Panda3D-1.6.2/etc
/…;/c/Program Files/panda/Panda3D-1.6.2/etc/…/models”)
Traceback (most recent call last):
File “new3.py”, line 49, in
{‘leftPunch’ : ‘models/rere’})
File “C:\Program Files\panda\Panda3D-1.6.2\direct\actor\Actor.py”, line 277, i
n init
self.loadModel(models, copy = copy, okMissing = okMissing)
File “C:\Program Files\panda\Panda3D-1.6.2\direct\actor\Actor.py”, line 1889,
in loadModel
model = loader.loadModel(modelPath, loaderOptions = loaderOptions, okMissing
= okMissing)
File “C:\Program Files\panda\Panda3D-1.6.2\direct\showbase\Loader.py”, line 16
8, in loadModel
raise IOError, message
IOError: Could not load model file(s): [‘models/re’]

And what is the full path to your model file? I bet it’s not c:/Program Files/panda/pnd/game1/models/re.egg .

David

Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:loader(error): Couldn’t load file c:/Program Files/panda/pnd/game1/models/re.eg
g: not found on model path (currently: “/c/Program Files/panda/pnd/game1;/c/Prog
ram Files/panda/Panda3D-1.6.2/etc/…;/c/Program Files/panda/Panda3D-1.6.2/etc/…
/models”)
Traceback (most recent call last):
File “new3.py”, line 49, in
{‘leftPunch’ : ‘c:/Program Files/panda/pnd/game1/models/rere.egg’})
File “C:\Program Files\panda\Panda3D-1.6.2\direct\actor\Actor.py”, line 277, i
n init
self.loadModel(models, copy = copy, okMissing = okMissing)
File “C:\Program Files\panda\Panda3D-1.6.2\direct\actor\Actor.py”, line 1889,
in loadModel
model = loader.loadModel(modelPath, loaderOptions = loaderOptions, okMissing
= okMissing)
File “C:\Program Files\panda\Panda3D-1.6.2\direct\showbase\Loader.py”, line 16
8, in loadModel
raise IOError, message
IOError: Could not load model file(s): [‘c:/Program Files/panda/pnd/game1/models
/re.egg’]
No.There is no problem

No, you misunderstand. You shouldn’t attempt to loadModel(‘c:/Program Files/panda/pnd/game1/models/re.egg’), because that’s a Windows-style path, not a Panda-style path. (The correct form would be loadModel(’/c/Program Files/panda/pnd/game1/models/re.egg’), but that’s beside the point.)

My point is that on your hard disk, where is re.egg located? You are trying to load it from the directory c:/Program Files/panda/pnd/game1/models/re.egg . I say this because the directory c:/Program Files/panda/pnd/game1 is on your model-path, and you are loading the file by the name “models/re”, which means it is looking for a file called “c:/Program Files/panda/pnd/game1/models/re.egg”.

You say that re.egg is on your disk in the right place, but I say that whatever you think the right place is, the model isn’t in “c:/Program Files/panda/pnd/game1/models/re.egg”, and therefore it’s not in the right place.

You need to either put the model into the directory “c:/Program Files/panda/pnd/game1/models”, or you need to change your code to load it from the directory where it actually is.

David

ok but I now have other problem:

Traceback (most recent call last):
File “new3.py”, line 49, in
{‘leftPunch’ : ‘c:/Program Files/panda/pnd/game1/models/erer.egg’})
NameError: name ‘self’ is not defined

This means an incorrect reference to self. I can’t help you diagnose it without being able to see the code in question.

Your questions appear to be fundamental programming / Python questions. Remember, Panda is a tool designed for people who are already experienced programmers. We’ll be happy to help you use Panda3D, but you will have to learn Python on your own. :slight_smile:

There are lots of good guidebooks and tutorials on the internet to try to help you learn Python programming. Try searching the forums here for “tutorial”; you will probably also find excellent references on python.org.

Also, don’t overlook other excellent 3-D engines which are better suited for people who are not as experienced at programming. Alice is one such engine that leaps immediately to mind.

David