Roblox UtilitiesDevlHub Roblox Documentation

Data type

RotationCurveKey

A time-value pair used with RotationCurve instances.

A time-value pair used with RotationCurve instances.

The Interpolation property dictates the interpolation mode for the segment started by this key and ended by the next key on the curve. Each segment may use a different interpolation mode.

The LeftTangent and RightTangent properties apply to the cubic interpolation mode and define the desired tangent (slope) at the key. Different left and right values can be used to encode discontinuities in slope at the key. Attempting to set a RightTangent value on a key that doesn't use the cubic interpolation mode will result in a runtime error. It is possible to set the LeftTangent property on any key, as it will be used should the preceding segment use cubic interpolation.

Constructors 1#

newReturns a new RotationCurveKey at a given time with a given CFrame.

new(time: number, cframe: CFrame, Interpolation: KeyInterpolationMode)#

Creates a new RotationCurveKey at a given time with a given CFrame. LeftTangent and RightTangent are left uninitialized and, if not initialized, tangent values of 0 will be used when evaluating the curve.

NameTypeDefaultDescription
timenumberTime at which to create the new RotationCurveKey.
cframeCFrameCFrame of the new RotationCurveKey.
InterpolationKeyInterpolationModeThe interpolation mode for the segment started by this key. Defaults to KeyInterpolationMode.Cubic.

Properties 5#

InterpolationKeyInterpolationModeThe key interpolation mode for the segment started by this RotationCurveKey.
TimenumberThe time position of this RotationCurveKey.
ValueCFrameThe CFrame value of this RotationCurveKey.
RightTangentnumberThe tangent to the right of this RotationCurveKey.
LeftTangentnumberThe tangent to the left of this RotationCurveKey.

Interpolation: KeyInterpolationMode#

Defines the interpolation mode used for the curve segment that begins at this key and ends at the next key. Possible values are KeyInterpolationMode.Constant (holds the key's value until the next key), KeyInterpolationMode.Linear (linearly interpolates between this key and the next using spherical linear interpolation), and KeyInterpolationMode.Cubic (uses a cubic hermite spline shaped by RightTangent and the next key's LeftTangent). Defaults to KeyInterpolationMode.Cubic.

Setting this property to a non-cubic mode automatically clears RightTangent (because tangent slope is only meaningful in cubic segments).

Time: number#

The time position of this RotationCurveKey along the curve's timeline, in seconds. Keys within a RotationCurve are kept sorted by ascending time; inserting a key at the same time as an existing key replaces the existing key. Defaults to 0.

Value: CFrame#

The rotation stored at this key, represented as a CFrame. Only the rotational component of the CFrame is used; the positional component is ignored. Defaults to CFrame.identity.

RightTangent: number#

The outgoing tangent (slope) at this key, controlling the shape of the cubic segment that extends toward the next key. Defaults to 0. This property can only be set when Interpolation is KeyInterpolationMode.Cubic; attempting to set it on a key with a different interpolation mode raises a runtime error. Returns nil if the tangent has not been explicitly assigned.

LeftTangent: number#

The incoming tangent (slope) at this key, controlling the shape of the cubic segment arriving from the previous key. Defaults to 0. Unlike RightTangent, this property can be set on a key regardless of its own interpolation mode, because the preceding segment may use cubic interpolation and needs a defined slope at its endpoint. Returns nil if the tangent has not been explicitly assigned.