2d distance for 3d points

Hi guys, i search for a command that calculate the distance between two 3d point (same as getDistance) but that return the distance in one of the 2d plane (xy,yz or xz) of the 3d objects.

Thanks for helping me.
cheers

Why not use pythagoras?
You can use getPos() on a node path and calculate the distances yourself. I wouldn’t worry much about performance, except you do that for multiple objects every frame

You can do

(point1.getXy() - point2.getXy()).length()

If you only need the distance for a comparison (like is it further than n units?), or for sorting, you can use the faster lengthSquared function and compare against the squared distance.
I think in recent versions of Panda you can also do the short-form “point.xy” instead of “point.getXy()”.

1 Like

Thanks for your help!
I didn’t know this use of length.