Vector3Curve
*Questo contenuto è tradotto usando AI (Beta) e potrebbe contenere errori. Per visualizzare questa pagina in inglese, clicca qui.
Rappresenta una curva vector 3D, raggruppando tre FloatCurve istanze.Ogni figlio FloatCurve può essere accessibile tramite i metodi Vector3Curve:X(), Vector3Curve:Y() e Vector3Curve:Z().I tre assi possono essere campionati simultaneamente tramite il metodo Vector3Curve:GetValueAtTime() .
Campioni di codice
--- 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()
Sommario
Proprietà
Metodi
Restituisce i tre FloatCurves (X, Y, Z) all'argomento del tempo passato.
Restituisce il FloatCurve controllando il canale X (la prima istanza figlia di tipo FloatCurve chiamata X ).
Restituisce il FloatCurve controllando il canale Y (la prima istanza figlia di tipo FloatCurve chiamata Y ).
Restituisce il FloatCurve controllando il canale Z (la prima istanza figlia di tipo FloatCurve chiamata Z ).
Proprietà
Metodi
GetValueAtTime
Restituisce i tre FloatCurves (X, Y, Z) all'argomento del tempo trascorso come un'array di tre numeri.Se manca una curva del canale o non viene trovata alcuna chiave nella curva, il canale viene valutato come nil .
Parametri
Tempo in cui ottenere il valore.
Restituzioni
I tre FloatCurves (X, Y, Z) all'argomento del tempo passato.
Restituisce il FloatCurve controllando il canale X (la prima istanza figlia di tipo FloatCurve chiamata X ).Se nessuno viene trovato, viene creato un vuoto FloatCurve .
Restituzioni
Restituisce il FloatCurve controllando il canale Y (la prima istanza figlia di tipo FloatCurve chiamata Y ).Se nessuno viene trovato, viene creato un vuoto FloatCurve .
Restituzioni
Restituisce il FloatCurve controllando il canale Z (la prima istanza figlia di tipo FloatCurve chiamata Z ).Se nessuno viene trovato, viene creato un vuoto FloatCurve .