Search Unity

Dynamically position camera with camera.pixelHeight

Discussion in 'AR' started by J1wan, Jul 27, 2020.

  1. J1wan

    J1wan

    Joined:
    Jun 4, 2020
    Posts:
    15
    I am using a Physics Raycast to detect GameObject collisions, but for app-specific reasons I want the camera position to be moved lower in the y-direction than the transfrom provided by
    Camera.main.transform.position
    . Right now I am directly modifying the value with a float constant as shown:
    cameraPoint.y -= .2f;
    , but I want to dynamically change the .y position with
    camera.pixelHeight
    .

    I tried modifying the camera height with
    cameraPoint.y -= camera.pixelHeight/4
    , but I couldn't get that to work. Does anyone know how to dynamically reposition the camera based off of
    Camera.pixelHeight
    ?