QuaternionExtensions.SmoothDamp

Extension Method in QuaternionExtensions

Declaration

public static Quaternion SmoothDamp(this Quaternion current, Quaternion target, ref Quaternion currentVelocity, float smoothTime, float maxSpeed = default(float))

Description

Gradually changes a quaternion towards a desired goal over time. The quaternion is smoothed by some spring-damper like function, which will never overshoot.

Parameters

currentThe current position.
targetThe position we are trying to reach.
currentVelocityThe current velocity, this value is modified by the function every time you call it.
smoothTimeApproximately the time it will take to reach the target. A smaller value will reach the target faster.
maxSpeedOptionally allows the maximum speed to be clamped.

Returns

QuaternionThe smoothed quaternion.