Matrix κ°μ²΄μ μμΉ νμ κ°μ μ»κ±°λ λ³κ²½ ν μ μμ΄μ.
μμ±
Matrixμ μμΉ κ°
-- μν --
local Cube = Workspace.Cube
local CubeTransform = Cube.Transform
print(CubeTransform.Location)
wait(2)
CubeTransform.Location = Vector.new(300, 0, 100)
Cube.Transform = CubeTransform
Matrixμ νμ κ°
-- μν --
local Cube = Workspace.Cube
local CubeTransform = Cube.Transform
print(CubeTransform.Rotation)
wait(2)
CubeTransform.Rotation = Vector.new(90, 45, 10)
Cube.Transform = CubeTransform
Matrixμ ν¬κΈ° κ°
-- μν --
local Cube = Workspace.Cube
local CubeTransform = Cube.Transform
print(CubeTransform.ScaleXYZ) --ν΄λΉ μ€λΈμ νΈμ ν¬κΈ°λ₯Ό 100μΌλ‘ λλ μ Vectorλ‘ λ°νν΄μ.(μλ₯Ό λ€μ΄ xκ°μ΄ 100μ΄λ©΄ 1λ‘ λ°νλΌμ.)
wait(2)
CubeTransform.ScaleXYZ = Vector.new(5, 5, 5)
Cube.Transform = CubeTransform
μμ±μ
Matrix λ₯Ό μμ±ν΄μ.
ν¨μ
void AddLocation(number x, number y, number z)
μ£Όμ΄μ§ κ°μΌλ‘ κΈ°μ‘΄ μμΉμ +λ‘ κ³μ°ν΄μ μμΉλ₯Ό μ€μ ν΄μ. (λνκΈ° ν X κ°, λνκΈ° ν Y κ°, λνκΈ° ν Z κ°)
-- μν --
local cube = Workspace.Cube
local cubeTransform = cube.Transform
print(cubeTransform.Location)
cubeTransform:AddLocation(200, 0, 0)
print(cubeTransform.Location)
cube.Transform = cubeTransform
void AddLocation(Vector Location)
μ£Όμ΄μ§ Vectorλ‘ κΈ°μ‘΄ μμΉμ +λ‘ κ³μ°ν΄μ μμΉλ₯Ό μ€μ ν΄μ. (λνκΈ° ν Vector κ°)
-- μν --
local cube = Workspace.Cube
local cubeTransform = cube.Transform
cubeTransform:AddLocation(Vector.new(0, 100, 0))
cube.Transform = cubeTransform
void AddRotation(Vector rotation)
μ£Όμ΄μ§ κ°μΌλ‘ κΈ°μ‘΄ κ°λμ +λ‘ κ³μ°ν΄μ κ°λλ₯Ό μ€μ ν΄μ. (λνκΈ° Vector κ°)
-- μν --
local cube = Workspace.Cube
local cubeTransform = cube.Transform
cubeTransform:AddRotation(Vector.new(0, 100, 0))
cube.Transform = cubeTransform
void AddRotation(number x, number y, number z)
μ£Όμ΄μ§ κ°μΌλ‘ κΈ°μ‘΄ κ°λμ +λ‘ κ³μ°ν΄μ κ°λλ₯Ό μ€μ ν΄μ. (λνκΈ° ν X κ°, λνκΈ° ν Y κ°, λνκΈ° ν Z κ°)
-- μν --
local cube = Workspace.Cube
local cubeTransform = cube.Transform
print(cubeTransform.Rotation)
cubeTransform:AddRotation(50, 0, 0)
print(cubeTransform.Rotation)
cube.Transform = cubeTransform
κ°μ²΄κ° λ°λΌλ³΄κ³ μλ λ°©ν₯ Vectorμ μ»μ μ μμ΄μ.
-- μν --
local cubeTransform = Workspace.Cube.Transform
print(cubeTransform:GetForward())
κ°μ²΄κ° λ°λΌλ³΄κ³ μλ λ°©ν₯μ μ€λ₯Έμͺ½ λ°©ν₯ Vectorλ₯Ό μ»μ μ μμ΄μ.
-- μν --
local cubeTransform = Workspace.Cube.Transform
print(cubeTransform:GetRight())
κ°μ²΄μ μμΈ‘ λ°©ν₯ Vectorλ₯Ό μ»μ μ μμ΄μ.
-- μν --
local cubeTransform = Workspace.Cube.Transform
print(cubeTransform:GetTop())
void LookAt(Vector TargetPostion, Vector UpVector)
νΉμ μμΉλ₯Ό λ°λΌλ³΄κ² λ³κ²½ν΄μ.
-- μν --
local transform = character.Transform
transform:LookAt(Workspace.Cube1.Location, Vector.new(0, 0, 150))
character.Transform = transform