private void BuildCamera()
        {
            var curvePoints = new CurveControlPoint[controlPoints.Length];
            for (var i = 0; i < controlPoints.Length; i++)
                curvePoints[i] = new CurveControlPoint(controlPoints[i].distanceToLookTarget, controlPoints[i].cameraAngle);
            var curve = new LerpCurve(curvePoints);

            cam = new AngledLookAtSurfaceCamera(transform, surface.GetSurface(), curve);
            cam.InitializeCamera();
        }
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceNormal = Vector3.up;
            surfaceUp = Vector3.forward;
            surface = new PlaneSurface(surfaceOrigin, surfaceNormal, surfaceUp);

            curvePoints = new CurveControlPoint[2];
            curvePoints[0] = new CurveControlPoint(1f, 10f);
            curvePoints[1] = new CurveControlPoint(10f, 90f);
            curve = new LerpCurve(curvePoints);

            var testGO = new GameObject();
            testTransform = testGO.transform;
            testObj = new AngledLookAtSurfaceCamera(testTransform, surface, curve);
        }
Exemple #3
0
 private float MapInputToRange(float input, ref CurveControlPoint min, ref CurveControlPoint max)
 {
     var percent = (input - min.Input) / (max.Input - min.Input);
     return Mathf.Clamp(percent, 0f, 1f);
 }
Exemple #4
0
 private float GetOutputFromRange(float percent, ref CurveControlPoint min, ref CurveControlPoint max)
 {
     return min.Output + (percent * (max.Output - min.Output));
 }