Following Camera

Sorry, another newbie question. I’m modifying the Roaming Ralph program still, and I want to have the camera turn when the player turns directions. Is there a better way to do this than the way the A and S keys work by shifting the camera position a certain amount? Can I just set the camera to point at his back at all time or something? Also, where might I find decent documentation on Panda3d, the website just seems to say everything is an ‘undocumented function’.

in simplest case you can reparent the camera to ralph. it might follow a little bit too directly but if thats what you want its ok. you could comment out all the rest of the code effecting the camera

Awesome thanks, I’ve got it working now. Where do I find decent documentation on panda3d classes and methods though?

In the manual you can find in-depth articles about various different subjects:
panda3d.org/manual/index.php

While in the API Reference you can get the per-class/per-method documentation:
panda3d.org/apiref.php?page=classes

Both are missing a lot and constantly say ‘undocumented function’. Is there anywhere else where these methods are defined with their input and output parameters?

Well, we’re doing the best we can to fill in the gaps in the documentation. I might go so far as to claim that most methods are, in fact, documented, especially the C+±based ones; but I’ll also be the first to agree that there are still large holes in certain sections of the code.

To fill in those holes, you can (a) look for examples here and in the samples code distributed with Panda, (b) look at the code itself, which is often pretty readable, especially for the Python-based methods, or © try searching the forums, or (d) if all else fails, ask a question here. If you’re able to ask a specific question, you should get a response fairly quickly; I think you’ll find that most people are happy to answer questions like this.

When you do figure out the answer to the question you’re asking, you might then consider filling in the documentation gap to help those who will come after you. You can do this either by writing an appropriate page for the manual, or by adding a missing piece to an existing page. If you want to fill in the generated API reference, you just need to add the missing Python doc-string for the undocumented functions (and then submit the patch to us for inclusion in the source tree).

David

drwr, most functions that the API Reference marks as “Undocumented function” are in fact documented using docstrings in the original source code. I think it must be a bug in gendocs.py that it doesn’t check the docstrings even if it is documented.

Oh, I wasn’t aware of that. OK, well, we’ll need to fix that bug.

David

(pro-rsoft feels some eyes pointed at him)

Okay, I took a stab at it. Is it supposed to look like this? :smiley:
pro-rsoft.com/screens/gendocs-working.png
instead of this;
pro-rsoft.com/screens/gendocs-notworking.png

Tagged it for 1.5.4.

Exactly pro-soft. At least they have started to get all the C++ type documentation out and replaced them with python style docs. That was REALLY confusing.

Great work, pro-rsoft, many thanks!

Functions written in C++ will have C+±type documentation, and functions written in Python with have Python-style documentation. This will remain true for the foreseeable future. This particular function was written in Python, so has Python-style documentation.

Note that, with or without the online API documentation, you can always view this information interactively with Python with something like this:

>>> from direct.filter.FilterManager import FilterManager
>>> help(FilterManager)

Or:

>>> from direct.filter.FilterManager import FilterManager
>>> help(FilterManager.renderSceneInto)

This works for C++ functions too:

>>> from pandac.PandaModules import *
>>> help(NodePath.reparentTo)

David

Awesome, finally got it to work. Last issue with the game is I’m having troubles with an animation from Maya. I can convert the .mb files into .egg animation files and model files, but the animation doesn’t seem to work. The exact conversion code I’m using is:

Model:
maya2egg2008 -a model -o carModel.egg carModel.mb

Animation
maya2egg2008 -a chan -o carModelDriving.egg carModelDriving.mb

The animation wont play in either pview, or my actual game. Strangely enough, the animation does play if i use -a both, but i need the animation in a separate egg so i can play many different animations. Any ideas?

You’re bringing the animation and the model from separate .mb files. Are you sure the joint hierarchy matches exactly? Try bringing the model from the carModelDriving.mb file just in case.

Also, you should use “-cn carModel” for both animation and model files, to ensure they have the same character name. It’s important that the character name matches across the model and all of its animations.

David