My current use of the translateZ function allows the camera to move forward or backward along its lookat direction. However, because translateZ moves it relatively, performing camera.translateZ(10);
and then another camera.translateZ(10);
will result in a total movement of 20 units for the camera. This limitation prevents me from using it in a tween animation where I need to interpolate values within that function.
As a solution, I am looking for a way to translate along the Z-axis in absolute coordinates. For instance, even when focusing on an object at the origin, I would like to set a specific distance_from_origin while still keeping the lookat direction intact.
camera.absTranslateZ(distance_from_origin);