RealityKit - How can I calculate distance between two anchorEntity?

there's position which is simd3 and there 's anchorEntity. I want to get distance between two.

how I did is

var distance = distance(position, ( self.modelentity.position(relativeTo:nil) )
var distance = distance(position, ( self.modelentity.position )

but both failed because it seems calculating distance between world origin anchor not distance between position to self.modelentity.

how can I calculate distance ?

Hi, can you expand your code snippet a bit? How are you calculating the first position value?

For world space something like this should work:

let distance = simd_distance(entityA.position(relativeTo: nil), entityB.position(relativeTo: nil))
RealityKit - How can I calculate distance between two anchorEntity?
 
 
Q