Closed jersonlatorre closed 2 years ago
The camera has a getPosition()
method which returns the camera's position in the 3D space. Use the p5 method dist()
to determine the distance between any points in space. I've updated this sketch to demonstrate. It finds the distance between the camera and the two end points of a line segment that runs through a cube. Then, in the HUD, depending on the mouse position, it displays the distance.
Thank you very much @jwdunn1 for your answer! That helps me a lot.
Is there any way to calculate the distance from a point to the camera plain even if the camera is rotating?