Using spatial ChaseCamera to follow so that the camera control the rotation of it?

I need to make a third-person camera, but want to use ChaseCamera for it. So far used chaseCam.setDragToRotate(false); and put cam.setRotation(player.getRotation()) in simpleUpdate thereby got what I wanted, but the mouse is appearing and simply leaks out of the screen ;-; how can I solve this?

To hide the cursor, just use:

Mouse.setGrabbed(true);

Thanks!

Two snippets for the cam:

private void initCamera() {

    app.getFlyByCamera().setEnabled(false);

    camNode = new CameraNode("CamNode", cam);
    //camNode.setControlDir(ControlDirection.SpatialToCamera);
    camNode.setLocalTranslation(new Vector3f(0, 3, 10));
    camNode.lookAt(carNode.getLocalTranslation(), Vector3f.UNIT_Y);

    carNode.attachChild(camNode);
            
}

@Override
public void update(float tpf) { 

    cam.setLocation(player.getPhysicsLocation().add(0,3f,0));
}

They come from an appState. I think the “.lookAt” and the “update” are interesting for you. The “carNode” is attached to the rootNode after all. Oh and camNode is instance of CameraNode!

If you don’t want to use fly cam… then don’t include its app state when you start your app.

Search for “remove flycamappstate” and you are bound to get a dozen hits. Easiest way is to just not include it in your constructor’s super() call. Oh, but that implies that you have a constructor for your app and you are only passing the app states you want on the super call. Worth investigating as that’s the “right way” in the end.