code ทำให้วัตถุเคลื่อนไหว
คัดลอกไปเป็นบางส่วนนะครับดูว่าต้องนำไปใส่ตรงไหนระหว่างcode
public class
PlayMovingScript : MonoBehaviour
{
Rigidbody rb;
// Start is called before the first frame
update
void Start()
{
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
}
private void FixedUpdate()
{
float moveHorizontal =
Input.GetAxis("Horizontal");
float moveVertical =
Input.GetAxis("Vertical");
Vector3 movement = new
Vector3(moveHorizontal, 0.0f, moveVertical);
rb.velocity = movement;
}
}
ใส่ให้ตรงนะครับ
ไม่มีความคิดเห็น:
แสดงความคิดเห็น