using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour
{
ย ย public float Speed=10f;
ย ย private float H, V;
ย ย private Vector3 Move_Point;
ย ย private Rigidbody This_Body;
ย ย public bool Transform_True__Rigidbody_False=true;
ย ย void Start()
ย ย {
ย ย ย ย This_Body = GetComponent<Rigidbody>();
ย ย }
ย ย void Update()
ย ย {
ย ย ย ย H = Input.GetAxis("Horizontal"); //์ํ์ถ์ ์ ๋ ฅ๋ฐ์ H์ ํ ๋น
ย ย ย ย V = Input.GetAxis("Vertical"); //์์ง์ถ์ ์ ๋ ฅ๋ฐ์ V์ ํ ๋น
ย ย ย ย Move_Point = new Vector3(H, 0f, V); //์์ง,์ํ์ถ์ ๊ฐ์ ์ด๋ ๋ฐฉํฅ์ผ๋ก ์ค์
ย ย ย ย if(Transform_True__Rigidbody_False==true) //ํธ๋์คํผ ๋ฆฌ์ง๋๋ฐ๋ ๋ถ์ธ ๋ณ์๊ฐ true๋ผ๋ฉด
ย ย ย ย { transform.Translate(Move_Point*Speed*Time.deltaTime); } //ํธ๋์คํผ ๊ธฐ๋ฐ ์ด๋
ย ย }
ย ย private void FixedUpdate()
ย ย {
ย ย ย ย if (Transform_True__Rigidbody_False == false) //ํธ๋์คํผ ๋ฆฌ์ง๋๋ฐ๋ ๋ถ์ธ ๋ณ์๊ฐ false๋ผ๋ฉด
ย ย ย ย { This_Body.velocity = new Vector3(H, 0f, V) * Speed; } //๋ฆฌ์ง๋๋ฐ๋ ๊ธฐ๋ฐ ์ด๋
ย ย }
}
๋๊ธ 0