going_balls/Assets/Scripts/BallController.cs
2025-02-15 14:29:00 +05:30

22 lines
523 B
C#

using UnityEngine;
public class BallController : MonoBehaviour
{
public Rigidbody Rb;
public float Speed;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void FixedUpdate()
{
float x = Input.GetAxis("Horizontal");
float y = Input.GetAxis("Vertical");
Rb.AddTorque(Vector3.right * x * Speed);
Rb.AddTorque(Vector3.forward * y * Speed);
}
}