Camera Zoom Calculation

Godot Version

4.6.3

Question

I'm attempting to create a "max zoom distance" with my camera, but it doesn't seem to be working. I've already set up my constant as well.

const CAMERA_ZOOM_RANGE:Vector2 = Vector2(50,200)
func _apply_zoom_velocity(cam:Camera3D = camera_3d) -> void:
	if cam_zoom_velocity != 0:
		var calculated_zoom:float = cam.position.z * cam_zoom_velocity
		if (calculated_zoom > CAMERA_ZOOM_RANGE.x) and (
			calculated_zoom < CAMERA_ZOOM_RANGE.y):
				cam.translate_object_local(Vector3(0,0,cam_zoom_velocity))
	cam_zoom_velocity = 0

How does it not work?

Just figured it out. I was multiplying the zoom velocity and not adding it :slight_smile: