Manually rotating Chase Camera

I’m trying to combine the best of two worlds. I want a camera that will follow the players movements such a using a camera node but I also want to be able to make offsets in the rotation and distance like with chase camera.

I tried using a chase camera then manually rotating my camera but the chase camera control over rides my rotations. The only way I could think of to fix this was by rotating the camera in the renderLoop after the camera control is updated but I can’t even remember what I needed to add to my class to get the renderLoop override since the wiki is down.

There has to be a better way to do it without writing a new camera class. Does anyone have any suggestions ?

To me, the chase camera does fill those 2 requirements. I’m not sure I understand your issue.

Also for the wiki try this http://davidb.github.io/sandbox_wiki_jme/jme3.html
(it’s the new “wiki” menu link btw)

The chase camera doesn’t follow the targets rotations it only follows the target. I want to use controls like the chase camera to make off sets in the camera’s position but when the player rotates I want the camera to rotate with it.

The chase camera doesn’t rotate with the target like the cameranode. However I can’t use both without one over riding the other.

Well did you try:

chaseCam.setSmoothMotion(true);
chaseCam.setTrailingEnabled(false);

It will slowly align with the target moving direction.

You can then play with setTrailingSensitivity() and setTrailingRotationInertia();

Thanks but that’s not what I want.

Imagine if you rotated the camera to the side of the player. Then whenever you rotated the player the camera would rotate with the player while of course still remaining the side perspective. I want to be able to off set the camera then rotate the player but have the offset still remain.

ok.
Maybe try the other way arround, rotate the player according to the cam movements?
Other than that I’m afraid you’ll have to make your own camera handler.

Add an intermediate node to the player, attach the camera to that. Rotate that node when you want the camera rotated relative to the player.

@jojoofu That’s what actually I had to do with my Spaceship “sim” game, I set up a CameraNode just behind the ship and then I set the LookAt at the ship node. From there you can move the CameraNode as you want with move/rotate methods, pretty much like @pspeed said

That was my original thought but if I do that I lose the functionality of the chase cam.

What I did was extend the ChaseCamera class then add a new rotation node. The new node shadows the camera until the turn key is pressed. Once the turn key is pressed it copies the players node movements.

This allows me to use the chase camera functions with my own build in design. Ultimately I think I will end up of having to write my own camera class but this will do for now.

@pspeed Also I’m not sure what you mean by attach the camera to a node. Is there away to attach it as child because if their is I’m not aware of it.

CameraNode camNode = new CameraNode("camNode", cam);

camNode.setEnabled(true);

//fatherNode is the node in which you have to attach the camNode
fatherNode.attachChild(new Node("CameraHook"));
Node cameraHook = (Node)fatherNode.getChild("CameraHook");
cameraHook.attachChild(camNode);
camNode.lookAt(fatherNode.getLocalTranslation(), Vector3f.UNIT_Y);

then you can move the camNode with move(), rotate around its axis(with rotate()) or rotate around the cameraHook node. It works for me, hope this helps in any way

I thought the chase camera chased something. Maybe I’m wrong and the name is misleading…