# TrackballControls - zoom by cursor calculation explanation

In order to make zooming into the cursor we do this code,

1. can someone please explain the part of the calculation when we unproject and sub, I delimited the part in comments? (in addition, I’ve tried to understand what unproject means according the documentary but I still don’t get it).

2. Why the zoom vector (let vector variable) has z=0.5 and not z=0?

`````` controls.domElement.addEventListener('wheel', event => {
event.preventDefault();

const { clientWidth, clientHeight } = controls.domElement;
const rect = controls.domElement.getBoundingClientRect();
const x = ((event.clientX - rect.left) / clientWidth ) * 2 - 1;
const y = -((event.clientY - rect.top) / clientHeight ) * 2 + 1;

let vector = new THREE.Vector3(x, y, 0.5);

// Can someoone explain this part of calculation
vector.unproject(camera);
vector.sub(camera.position);
// till here

const factor = 20;

if (event.deltaY < 0) {
`vector` represents a point in 3D space. The above subtraction results in a new vector which points from the camera’s position to the mentioned point. If you compute its length, it’s the actual distance between both points.