Hopefully simple camera question..

I’m still here, I didn’t post up a couple questions then leave never to return… I just get really busy with outside stuff from time to time.

Anyway, I’m not sure conceptually how to setup the camera for a 3d isometric style game. I can reparent the camera to the character and as the character moves the camera follows just fine. However, I don’t want the camera to rotate around the character as it turns. I realize I can manually reposition the camera every frame, but I’d much prefer a method that creates, parents, positions, whatevers the camera relative to the character then just move the character around and have the camera automatically remain at a fixed position relative to where the character is in the world.

Since no replies have been made thus far, I’ll provide my own solution. Note please, however, that it may well not be the best.

What I seem to recall having done for a similar situation was to place the character that the camera should follow under two parent nodes, one of which controls the character’s position and the other of which controls its direction.

Since you want the camera to follow, but not rotate with the character, I suggest placing the direction node beneath the position node, giving you the following hierarchy:

PosNode
 |
 |
DirectionNode
 |
 |
Character

When updating the character, simply update PosNode’s position, but not its orientation, and DirectionNode’s orientation, but not its position. (Well, you would presumably be acting on the NodePaths for those nodes, but that’s largely neither here nor there for this discussion.)

The camera can then be parented to PosNode, giving you the following:

            PosNode
     __________|____
    /               \
  /                   \
DirectionNode          Camera
 |
 |
Character

The camera should thus then follow the player, but not rotate with it.

Of course, in your case “DirectionNode” may be superfluous, in which case you might just orient the character using its own NodePath.

Finally, you could also, I believe, use a CompassEffect (which is the better solution I don’t know, I’m afraid - the CompassEffect may well be more efficient).

Good luck! :slight_smile:

Actually, that is much easier using a compass effect.
panda3d.org/apiref.php?page=NodePath#setCompass

looks embarrassed Heh, true; I don’t think that I knew about CompassEffect when I created the schema that you see above.

As I said, CompassEffect may well be more efficient - I probably should have mentioned it before my own solution. ^^; )

I didn’t even know CompassEffect existed. I did read the manual, so either it’s not in there or I just plain missed it.

Anyway, I thought about the first solution, but it’s not obvious to me that it would even work. The Compass Effect looks to be exactly what I want though, so it should be perfect.

Indeed, the CompassEffect probably is better for your purposes. :slight_smile:

As to my own solution, I seem to recall using something along those lines for a case in which I wanted to have a camera that would follow the player in position, but which was independently orientable, and I seem to recall that it worked in that case (although a CompassEffect may well have worked as well, if not better).