μΌ | μ | ν | μ | λͺ© | κΈ | ν |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- λ°±μλ
- SSE
- ChatGPT
- 리μ‘νΈλ€μ΄ν°λΈ
- μ΄νκ³μ
- spring
- λͺ¨λ°μΌμ±νλ‘κ·Έλλ°
- 컴곡
- μλ£κ΅¬μ‘°
- μΉκ°λ°
- λ°±μ€1436
- μ»΄ν¨ν°κ³΅ν
- μ½λ©ν μ€νΈ
- νλ‘ νΈμ€λ
- λ°±μ€νμ΄
- μ€νλ§
- 그리λμκ³ λ¦¬μ¦
- μ°μ μμν
- μκ³ λ¦¬μ¦
- λ¨μν μ€νΈ
- 그리λ
- boj11653
- νμ΄μ¬
- νλ‘κ·Έλλ°
- κ°λ°μ
- λ°±μ€
- 리μ‘νΈ
- μΉκ°λ°κΈ°λ‘
- 컴곡μ
- μ½λ©
- Today
- Total
π»ππ§π
μ λν° μ λ¬Έ κ°μ’ B7~B9 λ³Έλ¬Έ
Input : κ²μ λ΄ μ λ ₯μ κ΄λ¦¬νλ ν΄λμ€ (λ§μ°μ€ μ λ ₯ λ±)
1. ν€ μ λ ₯
anyKeyDown : μ무 μ λ ₯μ μ΅μ΄λ‘ λ°μ λ true
anyKey : μ무 μ λ ₯μ λ°μΌλ©΄ true
GetKey : ν€λ³΄λ λ²νΌ μ λ ₯μ λ°μΌλ©΄ true
(anyKey μ GetKey λ λλ μ λμ λμ λλ ν¬ν¨ μν¨)
KeyCode.Return : ‘μν°λ₯Ό μ λ ₯νμ λ’ μ κ°μ
2. λ§μ°μ€ μ λ ₯
GetMouse(μ«μ) : λ§μ°μ€ λ²νΌ μ λ ₯μ λ°μΌλ©΄ true
GetMouseButtonDown(μ«μ) : λ§μ°μ€ λ²νΌμ ν΄λ¦νμ λ
GetMouseButtonUp(μ«μ) : λ§μ°μ€λ₯Ό ν΄λ¦νκ³ λμ λ
Project Setting -> Input Manager μμ Button μ€μ κ°λ₯
3.λ²νΌ μ λ ₯ (λ¬Έμμ΄ μ리μ Input λ²νΌ μ΄λ¦ μ μΌλ©΄ λ¨)
GetButton(“λ¬Έμμ΄”) : Input λ²νΌ μ λ ₯μ λ°μΌλ©΄ true
GetButtonDown(“λ¬Έμμ΄”) : Input λ²νΌ μ λ ₯μ΄ λ리면 true
GetButtonUp(“λ¬Έμμ΄”) : Input λ²νΌ μ λ ₯μ΄ λλ Έλ€ λΌμ§λ©΄ true
μμ
if(Input.anyKeyDown)
Debug.Log("νλ μ΄μ΄κ° μ무 ν€λ₯Ό λλ μ΅λλ€.");
if(Input.GetKeyDown(KeyCode.Return))
Debug.Log("μμ΄ν
μ ꡬμ
νμμ΅λλ€.");
if(Input.GetKey(KeyCode.LeftArrow))
Debug.Log("μΌμͺ½μΌλ‘ μ΄λ μ€");
if(Input.GetKeyUp(KeyCode.RightArrow))
Debug.Log("μ€λ₯Έμͺ½ μ΄λμ λ©μΆμμ΅λλ€.");
if(Input.GetMouseButtonDown(0))
Debug.Log("λ―Έμ¬μΌ λ°μ¬");
if(Input.GetMouseButton(0))
Debug.Log("λ―Έμ¬μΌ λͺ¨μΌλ μ€...");
if(Input.GetMouseButtonUp(0))
Debug.Log("μνΌ λ―Έμ¬μΌ λ°μ¬!!");
if(Input.GetButton("Horizontal"))
{
Debug.Log("ν‘ μ΄λ μ€..."+ Input.GetAxisRaw("Horizontal"));
}
if(Input.GetButton("Vertical"))
{
Debug.Log("μ’
μ΄λ μ€..."+ Input.GetAxisRaw("Vertical"));
}
GetAxis : μν, μμ§ λ²νΌ μ λ ₯μ λ°μΌλ©΄ float
GetAxixRaw : GetAxisμ λ€λ₯΄κ² λ± λ¨μ΄μ§λ κ°μ΄ λμ΄ 1or -1 λμμ λ²νΌ λλ₯΄λ©΄ 0μ΄ λμ¬ λλ μμ.
Transform : μ€λΈμ νΈ ννμ λν κΈ°λ³Έ μ»΄ν¬λνΈ
μ€λΈμ νΈλ λ³μ transformμ νμ κ°μ§κ³ μμ.
Vector2 : 2μ°¨μ
Vector3 : 3μ°¨μ
<Vector3 ν΄λμ€μ λ©μλ>
MoveTowards : λ±μ μ΄λ
->λ§€κ°λ³μλ (νμ¬μμΉ, λͺ©νμμΉ, μλ)λ‘ κ΅¬μ±
->κΌ Update() ν¨μ μμμ μ¬μ©ν΄μΌ ν¨
SmoothDamp : λΆλλ¬μ΄ κ°μ μ΄λ
->λ§€κ°λ³μλ (νμ¬μμΉ, λͺ©νμμΉ, μ°Έμ‘° μλ, μλ)
->λ§μ§λ§ λ§€κ°λ³μμ λ°λΉλ‘νμ¬ μλ μ¦κ°
Lerp : μ ν 보κ°, SmoothDamp λ³΄λ€ κ°μ μκ°μ΄ κΉ
->λ§μ§λ§ λ§€κ°λ³μμ λΉλ‘νμ¬ μλ μ¦κ° (μ΅λκ° 1)
Slerp : ꡬ면 μ ν 보κ°, νΈλ₯Ό 그리며 μ΄λ -> ν¬λ¬Όμ μ΄λ
ref : μ°Έμ‘° μ κ·Ό -> μ€μκ°μΌλ‘ λ°λλ κ° μ μ© κ°λ₯
transform.position = Vector3.MoveTowards(transform.position,target,1f);
Vector3 velo = Vector3.zero;
transform.position = Vector3.SmoothDamp(transform.position,target,ref velo,0.1f);
transform.position = Vector3.Slerp(transform.position, target, 0.001f);
<Time.deltaTime μ¬μ©νλ λ°©λ²>
deltaTime κ°μ νλ μμ΄ μ μΌλ©΄ ν¬κ³ , νλ μμ΄ λ§μΌλ©΄ μμ
Vector3 vec = new Vector3(Input.GetAxisRaw("Horizontal")*Time.deltaTime,Input.GetAxisRaw("Vertical")*Time.deltaTime,transform.Translate(vec));
μ΄λ° μμΌλ‘ μ‘°μ
Translate : 벑ν°μ κ³±νκΈ°
transform.translate(Vec*Time.deltaTime);
Vector ν¨μ : μκ° λ§€κ°λ³μμ κ³±νκΈ°
Vector3.Lerp(Vec1, Vec2, T*Time.deltaTime);
'Unity + C#' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
μ λν° μ λ¬Έ κ°μ’ B0~B6 (0) | 2022.07.24 |
---|