Camera rotation on mouse move

Problem is when user drive a car, user should be able to look around on mouse move. secondly the camera should follow car from decent distance. also I want to drive car with WASD and Up,Down,Right,Left. I mapped input control with WASD and Up,Down,Right,Left. but camera also moving along with it.

Rather than a troubleshooting request, this sounds more like a project specification… please be more specific. :wink:

I am learning JME3 and using Ferrari/Car.scene and I am trying to drive car in town scene. right now I am able to drive car but the camera is static and stick to car. see below code.

camNode = new CameraNode(“CamNode”, cam);
camNode.setLocalTranslation(new Vector3f(0, 6, 20));
Quaternion quat = new Quaternion();
quat.lookAt(new Vector3f(0.0f, 0.0f, -1.0f), Vector3f.UNIT_Y);

I also have mapped keys

inputManager.addMapping(“Lefts”, new KeyTrigger(KeyInput.KEY_LEFT));
inputManager.addMapping(“Rights”, new KeyTrigger(KeyInput.KEY_RIGHT));
inputManager.addMapping(“Ups”, new KeyTrigger(KeyInput.KEY_UP));
inputManager.addMapping(“Downs”, new KeyTrigger(KeyInput.KEY_DOWN));

What I am wanting to do is camera should follow car and it should be free to rotate.

In short I want to make car driving like GTA4. GTA IV Gameplay Driving Around - YouTube

You probably need ChaseCamera:

I tried works nice for following car, but not able to take control of mouse. to rotate camera I have to left click and drag, I want to rotate camera by simply moving mouse. I want to add some other functionality for clicking mouse button.