Vector3Curve

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

3D 벡터 곡선을 나타내며, 3개의 FloatCurve 인스턴스를 그룹화합니다.각 자식 FloatCurveVector3Curve:X() , Vector3Curve:Y()Vector3Curve:Z() 메서드를 통해 액세스할 수 있습니다.세 축은 메서드 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

패스된 시간 인수에서 세 가지 FloatCurves(X, Y, Z)를 배열로 세 가지 숫자로 반환합니다.채널 곡선이 누락되거나 곡선에서 키가 발견되지 않으면 채널은 nil로 평가됩니다.

매개 변수

time: number

값을 가져올 시간.

기본값: ""

반환

패스된 시간 인수에 있는 세 개의 FloatCurves(X, Y, Z)입니다.

X 채널을 제어하는 FloatCurve 를 반환하여 (형식 FloatCurve 의 첫 번째 자식 인스턴스인 이름 X )를 제어합니다.찾을 수 없으면 빈 FloatCurve 가 생성됩니다.


반환

Y 채널을 제어하는 FloatCurve 를 반환(유형 FloatCurve 의 첫 번째 자식 인스턴스 이름 Y)합니다.찾을 수 없으면 빈 FloatCurve 가 생성됩니다.


반환

Z 채널을 제어하는 FloatCurve 를 반환하여 (형식 이름 FloatCurve 인 첫 번째 자식 인스턴스) Z 이름으로 지정합니다.찾을 수 없으면 빈 FloatCurve 가 생성됩니다.


반환

이벤트