Matrix
Matrix 객체의 위치 회전 값을 얻거나 변경 할 수 있어요.
속성
Location
Matrix의 위치 값
-- 샘플 --
local Cube = Workspace.Cube
local CubeTransform = Cube.Transform
print(CubeTransform.Location)
wait(2)
CubeTransform.Location = Vector.new(300, 0, 100)
Cube.Transform = CubeTransform
Rotation
Matrix의 회전 값
-- 샘플 --
local Cube = Workspace.Cube
local CubeTransform = Cube.Transform
print(CubeTransform.Rotation)
wait(2)
CubeTransform.Rotation = Vector.new(90, 45, 10)
Cube.Transform = CubeTransform
ScaleXYZ
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 new()
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 GetForward()
객체가 바라보고 있는 방향 Vector을 얻을 수 있어요.
-- 샘플 --
local cubeTransform = Workspace.Cube.Transform
print(cubeTransform:GetForward())
Vector GetRight()
객체가 바라보고 있는 방향의 오른쪽 방향 Vector를 얻을 수 있어요.
-- 샘플 --
local cubeTransform = Workspace.Cube.Transform
print(cubeTransform:GetRight())
Vector GetTop()
객체의 위측 방향 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
Last updated
Was this helpful?