measuring proximity with transform.distance

Hello everybody,

I’m doing a research about “proximity”, meaning “personal space” which I want to measure between my player (aka the user) and the avatars standing next to him. In real world, the theory of personal space can be measured by centimeters, for example, social space is ~60 cm, but how do I measure this in Unity?

I’ve read that usually the default measures in unity are 1 unity unit = 1 meter (right?), can I get the distance between the user and the avatar based on this units and be able to “read” this as centimeters when I write it in my log file?

I want to be able to get a log: avatar is “_____” cm from the user.

note: it’s in VR environment

Thank you.

This all depends on the size of your models. If the model of a human is 100 units tall, then NO, meters does not apply. But if your models of humans measure a normal human height in METERS (approx 1.75m), then yes, you can use the computed distance to get the distance between objects/human positions in meters (multiply by 100 for centimeters).

Keep in mind, the distance between the humans’ positional “centers”, is NOT equal to the distance between the SURFACE of the humans. This is much more complex to compute since you cannot JUST use the object positions to do this computation, but need to take into account the shape of the human (mesh) itself.

You could use Vector3.Distance and then enter the positions of the player and the avatar.
This should return the distance between them in Unity units.
Unity units are equal to meters, so then multiply the distance by 1000 to get centimeters.
Hope this helped.
Heres the link the Vector3.Distance docs: