Vector3Curve

非推奨を表示

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。

3D ベクトルカーブを表し、3つの FloatCurve インスタンスをグループ化します。それぞれの子供 FloatCurve は、Vector3Curve:X()Vector3Curve:Y()、およびVector3Curve:Z()メソッドを介してアクセスできます。3つの軸は、メソッド Vector3Curve:GetValueAtTime() で同時にサンプリングできます。

コードサンプル

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()

概要

方法

プロパティ

方法

GetValueAtTime

パス時間引数において、3つの FloatCurves (X、Y、Z) を配列の 3 つの数字として返します。チャンネルカーブが欠落しているか、カーブにキーが見つからない場合、チャンネルは nil と評価されます。

パラメータ

time: number

値を取得する時間。

既定値: ""

戻り値

パス時間引数の FloatCurves (X、Y、Z)の 3 つ。

X チャネルを制御する FloatCurve を返し、タイプ FloatCurve の最初の子インスタンスで名前付きの X 。見つからない場合は、空の FloatCurve が作成されます。


戻り値

Y チャネルを制御する FloatCurve を返し、タイプ FloatCurve の最初の子インスタンスで名前付きの Y 。見つからない場合は、空の FloatCurve が作成されます。


戻り値

Z チャネルを制御する FloatCurve を返し、タイプ FloatCurve の最初の子インスタンスで名前付きの Z 。見つからない場合は、空の FloatCurve が作成されます。


戻り値

イベント