using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerball : MonoBehaviour
{
Rigidbody rigid;
void Awake()
{
rigid = GetComponent<Rigidbody>(); //rigird 초기화
}
void FixedUpdate() //방향키를 통해 움직이는 기능
{
float h = Input.GetAxisRaw("Horizontal");
float v = Input.GetAxisRaw("Vertical");
rigid.AddForce(new Vector3(h, 0, v), ForceMode.Impulse);
}
}
Download
Import