Reputation: 209
I am looking for the method to find the distance of one Node from other Node in ARCore sceneform SDK. I have looked into overlapTestAll()
and overlapTest()
which only returns a list node that are colliding with each other. I am assuming this method is returning list by calculation of distance between the nodes.
Upvotes: 0
Views: 1568
Reputation: 689
Get distance between vectors in meters:
private float getDistanceBetweenVectorsInMeters(Vector3 to, Vector3 from)
{
// Compute the difference vector between the two hit locations.
float dx = to.x - from.x;
float dy = to.y - from.y;
float dz = to.z - from.z;
// Compute the straight-line distance (distanceMeters)
return (float) Math.sqrt(dx * dx + dy * dy + dz * dz);
}
Upvotes: 1
Reputation: 76849
use getWorldPosition() and then you can calculate the difference between the two x/y/z positions.
Upvotes: 0