Vector3Curve

Mostrar obsoleto

*Este contenido se traduce usando la IA (Beta) y puede contener errores. Para ver esta página en inglés, haz clic en aquí.

Representa una curva vectorial 3D, agrupando tres instancias FloatCurve.Cada niño FloatCurve puede accederse a través de los métodos Vector3Curve:X(), Vector3Curve:Y() y Vector3Curve:Z().Los tres ejes se pueden muestrear simultáneamente a través del método Vector3Curve:GetValueAtTime().

Muestras de código

Creating a Vector3Curve

--- Vector3Curve
local function createVector3Curve()
local vectorCurve = Instance.new("Vector3Curve")
local curveX = vectorCurve:X() -- creates and returns a FloatCurve animating the X channel
local curveY = vectorCurve:Y() -- creates and returns a FloatCurve animating the Y channel
-- Not setting the Z channel will leave the Z channel not animated.
-- A missing curve or a curve with no keys don't participate in the animation
local key = FloatCurveKey.new(0, 1) -- creates a key at time 0 and with value 1
curveX:InsertKey(key)
curveY:InsertKey(key)
local key2 = FloatCurveKey.new(1, 2) -- creates a key at time 1 and with value 2
curveX:InsertKey(key2)
curveY:InsertKey(key2)
return vectorCurve
end
local function testVector3Curve()
local curve = createVector3Curve()
-- sampling the curve at a given time (returns a vector3)
print(curve:GetValueAtTime(0)) -- returns 1, 1, void
print(curve:GetValueAtTime(0.5)) -- returns 1.5, 1.5, void (result of cubic interpolation with auto tangents)
curve:X():RemoveKeyAtIndex(1)
curve:X():RemoveKeyAtIndex(1)
print(curve:X().Length) -- number of keys = 0
print(curve:GetValueAtTime(0.5)) -- returns void, 1.5, void
end
testVector3Curve()

Resumen

Métodos

Propiedades

Métodos

GetValueAtTime

Devuelve los tres FloatCurves (X, Y, Z) al argumento de tiempo pasado como un array de tres números.Si falta una curva de canal o no se encuentra una clave en la curva, el canal se evaluará como nil .

Parámetros

time: number

Tiempo en el que obtener el valor.

Valor predeterminado: ""

Devuelve

Los tres FloatCurves (X, Y, Z) en el argumento de tiempo pasado.

Devuelve el FloatCurve que controla el canal X (la primera instancia hija de tipo FloatCurve llamada X ).Si no se encuentra ninguno, se crea un vacío FloatCurve .


Devuelve

Devuelve el FloatCurve que controla el canal Y (la primera instancia hija de tipo FloatCurve llamada Y ).Si no se encuentra ninguno, se crea un vacío FloatCurve .


Devuelve

Devuelve el FloatCurve que controla el canal Z (la primera instancia hija de tipo FloatCurve llamada Z ).Si no se encuentra ninguno, se crea un vacío FloatCurve .


Devuelve

Eventos