コード例 #1
0
        public override void Update()
        {
            var player = Local.Pawn as Player;

            if (player == null)
            {
                return;
            }

            // lerp the focus point
            FocusPoint = Vector3.Lerp(FocusPoint, GetSpectatePoint(), Time.Delta * 50.0f);

            Vector3 targetPos = FocusPoint + GetViewOffset();

            // Col: cast ray from focus point to target
            var traceResult = Trace.Ray(FocusPoint, targetPos).Radius(boxSize).WorldOnly().Run();

            targetPos = traceResult.EndPos;             // Shift camera away from wall

            // Set positions
            Pos = targetPos;
            Rot = player.EyeRot;

            FieldOfView = ExtractionConfig.FieldOfView;
            Viewer      = null;
        }