How can find the distance between two 3D objects in a 3D space?

Hello genius!
I’m a beginner and I need your help.
How can I find the distance between two 3D objects in a 3D space?

Hi,

you can also use dist or PVector.dist like in 2D for 3D coordinates.

Cheers
— mnse

1 Like

Hello,

In addition to the helper functions it is good to know the math under the hood:

Processing source for dist() function:
https://github.com/processing/processing4/blob/master/core/src/processing/core/PApplet.java#L4750

Give it a moment to open and find the line! Slow here for me in Google Chrome.

The PVector one is in here:
https://github.com/processing/processing4/blob/master/core/src/processing/core/PVector.java

:)

1 Like