Setting Camera direction

Hi all,

I just want to set the camera’s direction, i.e please look down the line defined by this vector.
The tutorial says you can do cam.setDirection(v), but no such method exists in my JME library.
Is it deprecated? If so, then how can I emulate that functionality?

Thank you very much

I’ve tried
Vector3f newDir = cam.getDirection().addLocal(new Vector3f(0,0.001f,0));
cam.setAxes(cam.getLeft(), cam.getUp(), newDir);
in the update hook but get a very strange movement that does not correspond a to a downward sweep (as would be expected from decreasing the y value)

check out: cam.lookAt/cam.lookAtDirection

also, never modify a getter like that, use the appropriate setter/method

1 Like
@wezrule said: check out: cam.lookAt/cam.lookAtDirection

also, never modify a getter like that, use the appropriate setter/method

That was the function I needed, thanks a lot! And I know for the getter, it was just to make a point.

Get in good habits even when making a point :wink:

After all strange movement could have been caused by incorrectly setting the values…