Log in or register to post comments

How can I get size of real object?

September 12, 2016 - 8:22pm #1

Hi all,

Please help me to figure out, how can I achieve the actual size of real Object?

I know that I need distance between of Object and Camera, also I need the FOV of Camera

This is how I find the distance between camera and object

Vector3 heading = transform.position - ARCameraReference.transform.position;

float distance = Vector3.Dot(heading, ARCameraReference.transform.forward);

lblDistance.text = "Distance : " +  distance.ToString();

 

FOV calculation is follow :

float vFOVrad = ARCameraReference.fieldOfView * Mathf.Deg2Rad;

float cameraHeightAt1 = Mathf.Tan((float)(vFOVrad * 0.5));

float hFOVrad = Mathf.Atan(cameraHeightAt1 * ARCameraReference.aspect) * 2;

float FOV = hFOVrad * Mathf.Rad2Deg;

Also please  help me to figure out, these code are correct or not

 

Thank you,

Su Mon

 

 

Log in or register to post comments