Roaming Ralph 3rd person Camera problem

Hey everyone, I’m fairly new to Panda3D and I am working in a team with fleshtheworld. I went to the Roaming Ralph code and edited it a little bit to make it use a mouse to rotate the camera around Ralph while using the WASD key setup for the movement.

My problem I’m having is I can’t separate the camera rotation from the pressing of the keys that rotate Ralph. For an example, if I rotate Ralph to the left, the camera will rotate with him. I do not want it to rotate with him, though. That’s why I’m using the mouse to rotate the camera.

I’ve implemented a dummy node to try to combat this issue, but the node seems to turn with Ralph as well, so the camera still ends up rotate with Ralph.

I’m sorry about the lack of code right now, but I can post up some of it later if necessary. Thanks

could it be that the camera or the dummy are reparented to ralph?
because if so everything ralph does, will affect your dummie and you camera.

try something like this:

self.dummy = NodePath(PandaNode("floater"))
slef.dummy.reparentTo(render)
def dummyPos(task):
  pos = self.ralph.getPos()
  z = self.ralph.getZ() + 5
  self.dummy.setPos(pos)
  self.dummy.setZ(z)
  return task.cont

taskMgr.add(dummyPos, "dummyPos")

this will create a dummy and place it on the same position as ralph and the get it to be 5 units above the center of ralph.
then add it to the task manager so it is called every frame.

this way it only inherites ralph’s position not it’s hpr.

PLEASE correct me if i’m wrong.

assainator

It probably would be a reparenting problem.
I’m also making a Third person project but I wanted to make the camera turn with the character.

Anyway just check all your reParents with your text editors search function and try to reparent the camera back to its right place.

If you RLY can’t find the problem, just post your code in here.
We will be able to help you but not to write an entire code.

assainator, thank you, I was looking for something like that for a while, but didn’t know how to implement it. It works perfectly now, thanks so much.

you’re welcome,

as you, i’m creating a 3rd person camera, the snippet i gave you was my first attempt to create it (i didn’t know repareting would help)

assainator