백터
float
Game 캔버스ui는 픽셀 Vector2
Scene은 3D Vector3
씬 단위는 유닛
z 앞
x 오른쪽
y 위
- 방향 백터(c백터)
this.transform.position = new Vector3(a, 1, 1);
Vector3 변수명 = this.transform.position;
위치 변경
월드 포지션, 절대 좌표
기본은 0,0,0
리셋하면 로테이션 값도 변하뮤
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class App : MonoBehaviour
{
private void Update()
{
float a = 10;
this.transform.position = new Vector3(a, 1, 1);
}
}
Transform.localPosition
길이=거리=크기, 방향
로컬 포지션, 부모 클래스 대비 상대 좌표
this.transform.localScale = new Vector3(a, 1, 1);
축 방향으로 스케일 변경
스프라이트 반전
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class App : MonoBehaviour
{
private void Update()
{
float a = 10;
this.transform.localScale = new Vector3(a, 1, 1);
}
}
this.transform.Rotate(0, 1f, 0);
축으로 회전
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class App : MonoBehaviour
{
private void Update()
{
this.transform.Rotate(0, 1f, 0);
}
}
this.transform.Translate(0.01f, 0, 0);
현재 위치에서 이동
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class App : MonoBehaviour
{
private void Update()
{
this.transform.Translate(0.01f, 0, 0);
}
}
Distance 오브젝트 간 거리 체크 및 충돌 감지 방법
유니티 draw arrow git : 방향 표시
https://gist.github.com/MatthewMaker/5293052#file-drawarrow-cs
DrawArrow.ForDebug(a, c, 5,Color.yellow, ArrowType.Solid); // 위치, 방향, 듀레이션 컬러, 화살표 모양
'게임 클라이언트 프로그래밍' 카테고리의 다른 글
게임 오브젝트에 연결된 클래스에 접근 하는 방법: Inspector 직접 연결 / 접근_한정자 게임오브젝트_타입 변수명; (0) | 2024.08.21 |
---|---|
게임 오브젝트에 연결된 클래스에 접근 하는 방법 GameObject.Find(); (0) | 2024.08.21 |
게임 오브젝트에 연결된 클래스에 접근 하는 방법: FindObjectOfType<T>(); (0) | 2024.08.21 |
라이프 사이클 = 이벤트 함수 실행 순서 (1) | 2024.08.19 |
룰렛 돌리기 (0) | 2024.08.19 |