Untitled
unknown
plain_text
3 years ago
487 B
9
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...