Matrix

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 λ₯Ό μƒμ„±ν•΄μš”.

ν•¨μˆ˜

주어진 κ°’μœΌλ‘œ κΈ°μ‘΄ μœ„μΉ˜μ— +둜 κ³„μ‚°ν•΄μ„œ μœ„μΉ˜λ₯Ό μ„€μ •ν•΄μš”. (λ”ν•˜κΈ° ν•  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

주어진 Vector둜 κΈ°μ‘΄ μœ„μΉ˜μ— +둜 κ³„μ‚°ν•΄μ„œ μœ„μΉ˜λ₯Ό μ„€μ •ν•΄μš”. (λ”ν•˜κΈ° ν•  Vector κ°’)

-- μƒ˜ν”Œ --

local cube = Workspace.Cube
local cubeTransform = cube.Transform

cubeTransform:AddLocation(Vector.new(0, 100, 0))
cube.Transform = cubeTransform

주어진 κ°’μœΌλ‘œ κΈ°μ‘΄ 각도에 +둜 κ³„μ‚°ν•΄μ„œ 각도λ₯Ό μ„€μ •ν•΄μš”. (λ”ν•˜κΈ° Vector κ°’)

-- μƒ˜ν”Œ --

local cube = Workspace.Cube
local cubeTransform = cube.Transform

cubeTransform:AddRotation(Vector.new(0, 100, 0))
cube.Transform = cubeTransform

주어진 κ°’μœΌλ‘œ κΈ°μ‘΄ 각도에 +둜 κ³„μ‚°ν•΄μ„œ 각도λ₯Ό μ„€μ •ν•΄μš”. (λ”ν•˜κΈ° ν•  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())

νŠΉμ • μœ„μΉ˜λ₯Ό λ°”λΌλ³΄κ²Œ λ³€κ²½ν•΄μš”.

-- μƒ˜ν”Œ --

local transform = character.Transform
transform:LookAt(Workspace.Cube1.Location, Vector.new(0, 0, 150))
character.Transform = transform

Last updated