Exemplo n.º 1
0
        private void UpdateStateData()
        {
            radius = currentState.radius;

            settings.fov = DirectorSmoothing.SmoothDamp(settings.fov, currentState.targetFOV, ref fovVelocity, currentState.fovDamp, Time.deltaTime);
            offset       = DirectorSmoothing.SmoothDamp(offset, currentState.originOffset, ref offsetVel, Time.fixedDeltaTime, Time.deltaTime);

            if (Mathf.Abs(settings.fov - currentState.targetFOV) <= 0.001f)
            {
                settings.fov = currentState.targetFOV;
            }

            if (Mathf.Abs(radius - currentState.radius) <= 0.001f)
            {
                radius = currentState.radius;
            }
        }
Exemplo n.º 2
0
        private void UpdateMove()
        {
            if (!canMove || follow == null)
            {
                return;
            }

            //Get postion and local rotation
            Vector3 origin         = follow.position;
            Vector3 targetPosition = origin + transposeRotation * new Vector3(localOffset.x, localOffset.y, localOffset.z - radius);

            //Get hit wall or max distance
            ray = new Ray(origin, (targetPosition - origin).normalized);
            float rayDistance = Mathf.Max(0.5f, SphereCast(ray, wallPadding, (targetPosition - origin).magnitude, collisionMask));

            //Get point on ray
            targetPosition    = ray.GetPoint(rayDistance);
            transposePosition = DirectorSmoothing.SmoothDamp(CameraTransform.position, targetPosition, ref transposeVelocity, moveDamp, Time.deltaTime);

            // CameraTransform.position = transposePosition;
        }