Home > Software design >  How can I calculate a distance between two AnchorEntities?
How can I calculate a distance between two AnchorEntities?

Time:02-19

There's a position which is SIMD3 and there's AnchorEntity. I want to get distance between two.

How I did it:

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?

CodePudding user response:

Theory

It's a little bit tricky in RealityKit 2.0

  • Related