Esempio n. 1
0
    //** Debug Methods **//
    private void drawDebug()
    {
        //Draw line from this cam to the observed object
        Debug.DrawLine(transform.position, observedObject.position, Color.gray);

        //Draw the hide obstruction Ray
        //hideRayCamToPlayer.draw(Color.black);

        //Draw the ZoomClip Ray, this isnt up to date since the cam has already lerped before this is called
        clipZoomRayPlayerToCam.draw(Color.white);
        DebugShapes.DrawRay(clipZoomRayPlayerToCam.getOrigin(), clipZoomRayPlayerToCam.getDirection(), clipZoomMinDistanceFactor * maxCameraDistance, Color.blue);
        DebugShapes.DrawRay(clipZoomRayPlayerToCam.getEnd(), -clipZoomRayPlayerToCam.getDirection(), clipZoomPaddingFactor * maxCameraDistance, Color.red);

        //Draw the angle restrictions
        Vector3 zeroOrientation = getHorizontalRotationAxis();
        Vector3 up   = Quaternion.AngleAxis(-camUpperAngleMargin, camTarget.right) * zeroOrientation;
        Vector3 down = Quaternion.AngleAxis(-camLowerAngleMargin, camTarget.right) * zeroOrientation;

#if UNITY_EDITOR
        if (!UnityEditor.EditorApplication.isPlaying)
        {
            UnityEditor.Handles.color = Color.white;
            UnityEditor.Handles.DrawSolidArc(observedObject.position, camTarget.right, down, Vector3.SignedAngle(down, up, camTarget.right), maxCameraDistance / 4);
        }
#endif

        //Draw Target Transform
        DebugShapes.DrawPoint(camTarget.position, Color.magenta, 0.1f);
        DebugShapes.DrawRay(camTarget.position, camTarget.forward, Color.blue);
        DebugShapes.DrawRay(camTarget.position, camTarget.right, Color.red);
        DebugShapes.DrawRay(camTarget.position, camTarget.up, Color.green);
    }
 private TargetInfo getDebugTargetRay()
 {
     debugModeRay.draw(Color.yellow);
     if (debugModeRay.castRay(out RaycastHit hitInfo, debugTargetRayLayer))
     {
         return(new TargetInfo(hitInfo.point, hitInfo.normal));
     }
     else
     {
         return(new TargetInfo(debugTarget.position, debugTarget.up));
     }
 }