エンジンクラス
Vector3Curve
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
概要
方法
GetValueAtTime(time: number):{any} |
X():FloatCurve |
Y():FloatCurve |
Z():FloatCurve |
コードサンプル
Vector3Curveを作成する
--- Vector3Curve
local function createVector3Curve()
local vectorCurve = Instance.new("Vector3Curve")
local curveX = vectorCurve:X() -- X チャンネルをアニメートする FloatCurve を作成して返します
local curveY = vectorCurve:Y() -- Y チャンネルをアニメートする FloatCurve を作成して返します
-- Z チャンネルを設定しないと Z チャンネルはアニメートされません。
-- 曲線が欠落しているか、キーのない曲線はアニメーションに参加しません
local key = FloatCurveKey.new(0, 1) -- 時間 0 でキーを作成し、値 1 を設定します
curveX:InsertKey(key)
curveY:InsertKey(key)
local key2 = FloatCurveKey.new(1, 2) -- 時間 1 でキーを作成し、値 2 を設定します
curveX:InsertKey(key2)
curveY:InsertKey(key2)
return vectorCurve
end
local function testVector3Curve()
local curve = createVector3Curve()
-- 特定の時間で曲線をサンプリングします (vector3 を返します)
print(curve:GetValueAtTime(0)) -- 1, 1, void を返します
print(curve:GetValueAtTime(0.5)) -- 1.5, 1.5, void を返します (自動タンジェントによる三次補間の結果)
curve:X():RemoveKeyAtIndex(1)
curve:X():RemoveKeyAtIndex(1)
print(curve:X().Length) -- キーの数 = 0
print(curve:GetValueAtTime(0.5)) -- void, 1.5, void を返します
end
testVector3Curve()APIリファレンス
方法