mirror of
https://github.com/CoonS2/Unity2DProject.git
synced 2026-02-04 12:13:22 +09:00
2DProject 및 Sprite 생성
1. 2DProject 생성 2. Sprite 및 AnimationController
This commit is contained in:
39
Assets/Controller.cs
Normal file
39
Assets/Controller.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Controller : MonoBehaviour
|
||||
{
|
||||
// 유니티 오브젝트는 GameObject 단위.
|
||||
// GameObject는 Componect를 소유하고 있다.
|
||||
// 소유 vs 상속 >> GameObject는 Componect를 소유하고 있는 개념
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
// 디자인 패턴
|
||||
// 유니티는 컴포넌트 패턴을 취하고 있다.
|
||||
|
||||
|
||||
var position = transform.position;
|
||||
Matrix4x4 positionMatrix= Matrix4x4.Translate(position);
|
||||
var scale = transform.localScale;
|
||||
var rotation = transform.rotation;
|
||||
|
||||
// 행렬
|
||||
// x, y, z 값을 행렬로 변환해 컴퓨터에 전달을 해준다.
|
||||
Matrix4x4 matrix = transform.localToWorldMatrix;
|
||||
|
||||
// 게임오브젝트 하나가 행렬을 가지고 있고.
|
||||
// 카메라가 행렬을 가지고 있다.
|
||||
|
||||
Matrix4x4 cameraMatrix = Camera.main.cameraToWorldMatrix;
|
||||
|
||||
Matrix4x4 result = cameraMatrix * matrix;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user