SmoothDamp() public static method

public static SmoothDamp ( float current, float target, float &currentVelocity, float smoothTime ) : float
current float
target float
currentVelocity float
smoothTime float
return float
コード例 #1
0
        public void Update()
        {
            if (velocity.magnitude <= 0.01f)
            {
                velocity = Vector3.zero;
            }

            transform.position = GetCameraClampedPosition();

            var cameraPosition = GetCameraPosition();

            transform.position =
                RequiredSmoothDamp ?
                new Vector3(
                    Mathf.SmoothDamp(transform.position.x, cameraPosition.x, ref velocity.x, DampTimeX, DampMaxSpeedX),
                    Mathf.SmoothDamp(transform.position.y, cameraPosition.y, ref velocity.y, DampTimeY, DampMaxSpeedY),
                    cameraPosition.z
                    ) :
                cameraPosition;

            RequiredSmoothDamp = true;
        }
コード例 #2
0
ファイル: Mathf.cs プロジェクト: qipa/UnityDecompiled-2
 public static float SmoothDampAngle(float current, float target, ref float currentVelocity, float smoothTime, [DefaultValue("Mathf.Infinity")] float maxSpeed, [DefaultValue("Time.deltaTime")] float deltaTime)
 {
     target = current + Mathf.DeltaAngle(current, target);
     return(Mathf.SmoothDamp(current, target, ref currentVelocity, smoothTime, maxSpeed, deltaTime));
 }
コード例 #3
0
ファイル: Mathf.cs プロジェクト: qipa/UnityDecompiled-2
        public static float SmoothDamp(float current, float target, ref float currentVelocity, float smoothTime, float maxSpeed)
        {
            float deltaTime = Time.deltaTime;

            return(Mathf.SmoothDamp(current, target, ref currentVelocity, smoothTime, maxSpeed, deltaTime));
        }