# beginner tutorial, control camera sin and cos

Why does the beginners tutorial on Controlling the camera (having it orbit around the panda) use sin and cos calculations. Wouldn’t it be clearer and easier to follow if a dummy node was parented to the panda (with a position of 0,0,0 relative to the panda) and then the base.camera would be parented to the dummy node with a position of 0,20,0 and then tell the camera to lookat the dummy node. Then rotate the dummy nodepath with dummyNP.setH(dummyNP.getH()+1) ?

It took me awhile to realize it when I started out, position and HPR is relative to the parent and is inherited from parent. It is easy to have an object ‘follow’ you. If you reparent a camera to the player and set its position to 0,-10,3 it will always be 10 units behind the player no matter if they turn or jump.

good question! I don’t know… write a simpler beginners tutorial?

Alot of the tutorials/demos are like this…another that pops to mind is using matrices to move Ralph.

Generally this seems to be the way to do things in a more basic engine (or directly directx/opengl) and not in an engine that could do it for you like panda3d.

This one, if looking at the problem from a mathematical perspective, is exactly the way to it. Same with the Ralph code…From a programming point of view there are “cheats” that could not apply to the real world but work marvelously in a game engine.

I think these happened simply because the person or persons who wrote these demos was already used to doing these sorts of things the “OpenGL way” and wasn’t aware that Panda provided a simpler way to do it.

I agree they should be updated to more effectively illustrate Panda’s preferred usage patterns. Would anyone like to volunteer for this task?

David

I’d be happy to if I could get a list of some sort of all the places that are un-panda like…All I can think of at the moment are the tutorial and the roaming ralph demo.