# finalPosition = position - vec3(0, ellipsoid.y, 0) + ellipsoidOffset What do these positions refer to

https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity

I don’t quite understand here, can you explain more specifically? It is best to use more marked pictures to illustrate.

Hi,

Here are some visual explanations:

In this example, the ground y position is set to 5 and the ellipsoid y is set to 1.

As explained in the documentation, the ellipsoid position is relative to the camera position and is defined by this formula:

finalPosition = position - vec3(0, ellipsoid.y, 0) + ellipsoidOffset

this means:

ellipsoidPosition = cameraPosition - vec3(0, ellipsoidDimension.y, 0) + ellipsoidOffset

So, in the default scenario:
The camera y position is set to 7, and the ellipsoid y position is
7 - 1 + 0 = 6

In the custom scenario:
The camera y position is set to 6.5, and the ellipsoid y position is
6.5 - 1 + 0.5 = 6

If you set the y position of the ground to 0, the camera will fall until the bottom of the ellipsoid touches the ground, this means that the camera stop falling at y = 2 in the default scenario and y = 1.5 in the custom one.

2 Likes

Thanks!