These are chat archives for highfidelity/hifi

Feb 2017
Michael Varner
Feb 14 2017 23:26
Hi everyone
I'm attempting to calculate the distance between two objects, and Vec3.distance is returning a value that doesn't make sense
Specifically a hand controller and a specific entity
Here's how I'm attempting to use it:
var leftHandDistanceToDrum = Vec3.distance(MyAvatar.getLeftHandPosition(), Entities.getEntityProperties(theDrumObjThis.entityID).position);
even when I have the controller and the entity on top of each other, it keeps spitting back ~200
Michael Varner
Feb 14 2017 23:36
I think I might be experiencing a relative position vs absolute position issue here

Here's my test output:

[1/14 15:35:9] [Entities 12] Left Hand Position: {"x":-0.30466270446777344,"y":-0.076904296875,"z":-0.25736474990844727}
[1/14 15:35:9] [Entities 12] Right Hand Position: {"x":-0.37178635597229004,"y":-0.078643798828125,"z":-0.3659062385559082}
[1/14 15:35:9] [Entities 12] drum position: {"x":-2.8897955417633057,"y":-199.9001007080078,"z":-9.967309951782227}
[1/14 15:35:9] [Entities 12] right hand distance to drum: 200.06784057617188

the hand controllers are almost next to the entity here
Michael Varner
Feb 14 2017 23:57
Would anyone advise as to what I might be doing wrong here and how to adjust?