기본 플레이어 컨트롤러 unity

코드 예제

3
0

간단한 플레이어 컨트롤러 unity

//USES A RIGIDBODY (Unity)//

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
   public float speed;
   
   private Rigidbody rb;
   
   
   
   //Start is called before the first frame update//
   void Start()
   {
       rb = GetComponent<Rigidbody>();
   }
   
   //Update is called once per frame
   void FixedUpdate()
   {
      float moveLR = Input.GetAxis("Horizontal");
      float moveFB = Input.GetAxis("Vertical");
      
      rb.AddForce (new Vector3(speed * moveLR, 0, speed * moveFB));
   }
}

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................