Panda3D Manual: FAQ
<<prev | top | next>> |
## Q: I have a bunch of Maya Animations of one model in different mb files. I used maya2egg to port them into panda, but only one of the animations work. ## A: The key is to use the -cn <character's name> flag in maya2egg for every file. This ensures that the files work together. Let's say you are making an animated dog. You have the following animations:
       dog-walk.mb
       dog-sit.mb
       dog-run.mb
To convert these into panda, you would call
       maya2egg6 dog-walk.mb -a model -cn dog -o dog-model.egg
Note, we can grab the model from any of the animations, as long as they are all using the exact same rig:
       maya2egg6 dog-walk.mb -a chan -cn dog -o dog-walk.egg
       maya2egg6 dog-sit.mb -a chan -cn dog -o dog-sit.egg
       maya2egg6 dog-run.mb -a chan -cn dog -o dog-run.egg
## Q: I'm using the lookAt function on a nodepath to point it at another object. It works fine until I point upwards, and then it starts to spin my object around randomly ## A: lookAt works as long as you aren't telling it to look in the direction of its up vector. Luckily, you can specify the up vector as the second argument.
       lookAt(object,Vec3(0,0,1))
## Q: I'm building a 3d game, and I have a huge world. When my world starts up, the program hangs for a few seconds the first time I look around. Is there any way to avoid this? ## A: It can take a while to prepare objects to be rendered. Ideally, you don't want this to happen the first time you see an object. You can offload the wait time to the beginning by calling:
       # self.myWorld is a nodepath that contains a ton of objects
       self.myWorld.prepareScene(base.win.getGsg())
This will walk through the scene graph, starting at self.myWorld, and prepare each object for rendering. ## Q: Is there a way to hide the mouse pointer so that it doesn't show up on my screen? ## A: You can change to properties of the panda window so that it doesn't show the cursor:
       props = WindowProperties()
       props.setCursorHidden(True)
       base.win.requestProperties(props)
## Q: If a model has an animation, is that animation necessarily represented by an additional .egg file? ## A: No. An .egg file can either be just geometry, just an animation, or a combination of the two. It's often easiest, however, to create a separate egg for every animation and an egg that contains just the model/skeleton information. ## Q: I have a model with an animation. When i try to play the animation I get this error:
       KeyError: lodRoot
       display: Closing wglGraphicsWindow
## A: This often happens when you are trying to load animations onto a model that wasn't exported to have animations. There are two pieces to objects that have animations; their geometry and their skeleton. The geometry is what you see when you load a model, the skeleton is what controls the geometry in an animation. If only the geometry was used to make the egg file, you will have problems when you try to play animations. Look at the manual for more details about exporting models as eggs. ## Q: I called setTexture('tex.jpg') and it didn't change or send an error. ## A: To override an existing texture, you need to specify a priority: setTexture('tex.jpg', 1). The setTexture() call includes an optional priority parameter, and if the priority is less than 1 the texture will not change. ## Q: I get this error:
       assert(self.validateComponents(self.ivals))
       AssertionError
It happens at this line of code:
       move = Sequence(obj.setX(5))
## A: Sequences and Parallels are a way to combine intervals. You can't put anything inside them that isn't an interval. If you want this code to work you want something like:
       self.move = Sequence(Func(obj.setX, 5))
This will start the execution of the function, but not wait for it to finish. ## Q: Does panda use degrees or radians? ## A: Degrees. But see also the deg2Rad() and rad2Deg() functions.
       But note that the math.sin, math.cos, math.tan, etc. functions are calculated in radians.
       Don't forget to convert the values!
## Q: Why do all my flat objects look weird when lit? ## A: Flats don't often have a lot of vertices. Lighting is only calculated at the vertices, and then linearly interpolated between the vertices. If your vertices are very far apart, lighting can look very strange--for instance, a point light in the center of a large polygon might not show up at all (the light is far from all four vertices, even though it's very near the polygon's center). One solution is to create a model with a lot of polygons to pick up the lighting. It also helps to make a flat surface slightly curved to improve its appearance. Another approach might be to create an ambient light that only affects this object. See the manual for more detail about attaching lights to objects in your scene.
<<prev | top | next>> |