magically disappearing Actor

Hello,

For some reason, my Actor will disappear.

I have a camera set up that’s always following my actor. When it gets so far away from it, the actor disappears. If it gets close enough, it then reappears…it seems to be a circular area (seems that the origin of this area is the original position of the Actor when first loaded into the scene) instead of a distance problem like with a clipping plane…it’s not going through a plane, just disappearing.

I also have a node that follows the actor. I can then switch my camera to that node using “reparentTo” and then use a “lookAt” to see my character. This also only seems to work in certain places as well. Sometimes I can see my character in my main camera, I switch to the close up, and the Actor isn’t there. I move it closer to where it originally started in the scene, and it will reappear.

Is there some sort of camera command that I’m missing or unaware of?

Thanks for any help.

-Brian

Can you post your camera code.

Actors have an annoying habit of animating themselves out of their bounding volumes. This can make them disappear.

A bit of background: Panda automatically computes the bounding volume of every object in the scene, and keeps the bounding volumes up-to-date as objects move around. It then uses these bounding volumes to decide which objects are actually visible to the camera, and which are not; if an object’s bounding volume is not within the camera’s viewing frustum, the object is not drawn.

However, Panda does not automatically recompute the bounding volume of an Actor, because Actors move their vertices around a lot, so recomputing this every frame would be too expensive. (We still have, on the todo list, the goal of precomputing the bounding volume animation and storing it with the animation channels, but this hasn’t been done yet.) Since usually Actors animate in place while lerps, etc., move the Actors around the world, this usually isn’t a problem.

However, every once in a while you have an Actor whose animation actually moves the Actor away from his origin. When this happens, then the bounding volume still shows him at his original point, and unless the camera is looking at both his original point and the Actor’s new point, he will disappear.

You can reveal the bounding volume with a call like:


object.showBounds()

If you see that your Actor is walking out of his bounding volume, one workaround is to give your Actor an infinite bounding volume. This means he will always be rendered, even if he is not in front of the camera. You can do this like this:

object.node().setBound(OmniBoundingVolume())
object.node().setFinal(1)

The second line tells Panda that the bounding volume on this node should be considered “final”; that is, not to look at any of the (still incorrect) bounding volumes below this node.

(Of course, an infinite bounding volume won’t be visible when you do showBounds(), but it’s there.)

David

I guess this is more of a question than a response:

Could this be a LOD problem? If the camera gets far enough away from the actor, and the actor switches to a LOD that is either non-existent or not visible, that might cause the problem.

But then again, I don’t know the situation very well (levels of detail might not even be used), and I dont even know if its possible to switch to a LOD that doesn’t render. I haven’t really thought about it before. So the question is, could that be the case or is it even possible?

That is certainly possible, but it would be difficult to set up an LOD without realizing you had done that, so I suspect it is more likely to be the culling problem described above.

David

Ok, thanks. I was more interested if it were actually possible to do such a thing, helps with the understanding of it all.

Maybe someone would want to set up such a situation, although I couldn’t think of why just yet.

Thanks, David!

That was it. I can now get it to work no matter where the Actor is located.

Thanks again.

-Brian