コード例 #1
0
        // Translate a 3D camera by a vector3.

        static void TranslateCamera(UiCam3D uicam, Vector3 delta)
        {
            GameObject cameraObject      = uicam.cameraObject;
            Constraint constraint        = uicam.constraint;
            Vector3    cameraPositionOut = cameraObject.transform.position;

            cameraPositionOut += delta;

            // Constraint is applied to camera object.

            if (constraint != null && constraint.hardClamp)
            {
                cameraPositionOut.x = Mathf.Clamp(cameraPositionOut.x, constraint.hardClampMin.x, constraint.hardClampMax.x);
                cameraPositionOut.y = Mathf.Clamp(cameraPositionOut.y, constraint.hardClampMin.y, constraint.hardClampMax.y);
                cameraPositionOut.z = Mathf.Clamp(cameraPositionOut.z, constraint.hardClampMin.z, constraint.hardClampMax.z);
            }

            // Translation is applied to camera object.

            cameraObject.transform.position = cameraPositionOut;
        }
コード例 #2
0
 public void AddUiCam3D(UiCam3D _cam)
 {
     uiCam3D = _cam;
 }