This one shouldn't be too hard....distance between two vector3fs?

How do I tell the distance between two Vector3fs in terms of linear distance? As in, a most likely diagonal line between two vector3fs. So it would be one number instead of three.

Thanks a ton.

Vector3f.distance(Vector3f)

1 Like

So say I had two vector3fs, a point 1 and a point 2, and then I wanted a number called line to be the distance between them. Would it be point1.distance(point2) = line?

no Vector3f.distance() returns a float representing how long the line would be between those points.

if you want to make a third vector that “connects” your other 2 vectors you’ll want to use point3 = point1.subtract(point2)

heres a cheat sheet that explains what each of the Vector3f math helper methods do: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:math , theres also an intro to game math video somewhere in the jmonkey tutorials somewhere.

1 Like

Thanks a ton, got it all working perfectly.