Today I Learned
[ TIL - 220928 ]
grace.codepoet
2022. 9. 29. 17:32
π μ΄μ체μ
νλ‘μΈμ€ : λ³ν μ€ν νλ‘κ·Έλ¨μ λ°μ μ λ€μν νλ‘κ·Έλ¨μ λ³΄λ€ κ²¬κ³ νκ² μ μ΄νκ³ λ³΄λ€ κ΅¬ννν κ²μ νμλ‘ νλ©΄μ νλ‘μΈμ€μ κ°λ μ λ³μμΌλ©°, νλ‘μΈμ€λ μ€ν μ€μΈ νλ‘κ·Έλ¨μ λ§νλ€. νλ‘μΈμ€λ νλ μ»΄ν¨ν μμ€ν μμ μμ μ λ¨μμ΄λ€.
πμ λν° : μκ²½μκ°μ§κ³ μμ νΉν μ΄ν΄μλλ ..
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class moveTest : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
public float moveSpeed = 0.1f;
public float rotationSpeed = 1f;
}
// Update is called once per frame
void Update()
{
float xInput = Input.GetAxis("Horizontal");
float zInput = Input.GetAxis("Vertical");
transform.Translate(0,0,zInput*moveSpeed); //Translateλ ν¨μ
transform.Rotate(0,xInput*rotationSpeed,0);
}
}
π νλ‘κ·Έλλ° μΈμ΄λ‘ 볡μ΅
π λ°μ΄ν° ν΅μ