Cam placement

I am try to set the camera in a particular position.



In Fig 1, its the cam’s current state, the code im using is as follows,



[java]

cam.setDirection(new Vector3f(-1,0,0));

cam.setLocation(new Vector3f(pn_player.getLocalTranslation().getX()+35,

pn_player.getLocalTranslation().getY()+2,

pn_player.getLocalTranslation().getZ()));[/java]







But I want to place the cameras in some position like Figure 2.

I tried cam.setDirection values, but none of them is yielding what i want.The cam is rotating like a trackball.



What will be the code for this?

[java]cam.setLocalTranslation(oldpostion.add(new Vector3f(0,10,0)));

cam.lookAt(playerLocation);[/java]

i forgot to mention, i tried cam.lookAt, but the screen starts shaking.



and lookat just give me a vision similar to Fig 1. I want something like Fig 2, where i will be able to set the angle the cam is making with the horizon.

I am sorry but look at TestPhysicsVehicle, it does exactly this, looking at the car each frame…

I assume you are talking about, “TestPhysicsCar.java”



Here is what is in the simple update function,

[java]cam.lookAt(vehicle.getWorldTranslation(), Vector3f.UNIT_Y);

[/java]



As I have said earlier cam.lookAt produces jitter and there is no way I can create an angle with the horizon with this.



and I think, i need to use the getLocalTranslation cause, this is a side scrolling game, and the cam is needed to be moving with the character.

It doesnt jitter, thats what I meant, so he jitteing is caused by some fault in your code or by the bug in the Character which will be fixed sooner or later, why make a workaround for a bug so big?