Query 3D Position of an Actor

Hello,

So looking at Panda3D documentation, I couldn’t find something along the lines of a getPOS() method on an actor. To use the walking panda tutorial as an example, I’d like to know the coordinates of the walking panda at a given point in time. Is this possible?

Thanks,

Joe

AFAIK, you can’t query an Actor’s position as it may be attached to multiple points of the scene graph, therefore having many ‘positions’.

You need to query the position of the Actor’s NodePath instead.

You should probably read this section of the manual explaining the Scene Graph.

http://panda3d.org/manual/index.php/The_Scene_Graph

What? An actor IS a NodePath!

print yourActor.getPos()

For some reason the API lists the inheritance wrong, but it definitely inherits from NodePath.

There appeared to be a bug in the tool that generates the API reference. It didn’t list inheritance for Python classes. I’ve just checked in a fix to the tool, the API should be updated on the upcoming release.

That’s quite a relief. I was getting pretty confused about how to get the NodePath of an Actor. Since an Actor is a NodePath, I can use getPos() for my AI algorithms.

As a follow-up, is there a way to generate documentation locally using the patched doc tool? I’d like to have accurate documentation without waiting for the next release.

Here’s a copy of the fixed API reference:
bin.pro-rsoft.com/panda3d-reference.zip
If you need chm, let me know and I’ll build it as soon as I’m on windows.

Awesome! Thanks, pro-rsoft. By far this is the quickest support forum I’ve ever used. My partner and I are still choosing a game engine for our AI project, but this right here just won me over to the Panda3D side.