Untitled
Anonymous
plain_text
12/15/2022 5:01 AM
652 B
18
Indexable
using UnityEngine;
public class CapsuleController : MonoBehaviour
{
public float speed = 10.0f;
private Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rb.AddForce(movement * speed);
}
}
Editor is loading...