This repository has been archived on 2024-11-16. You can view files and clone it, but cannot push or open issues or pull requests.

14 lines
386 B
C#
Raw Normal View History

2021-02-01 18:10:45 +08:00
using UnityEngine;
public class MovingSphere : MonoBehaviour
{
private void Update()
{
Vector2 playerInput;
playerInput.x = Input.GetAxis("Horizontal");
playerInput.y = Input.GetAxis("Vertical");
playerInput = Vector2.ClampMagnitude(playerInput, 1f);
transform.localPosition = new Vector3(playerInput.x, 0.5f, playerInput.y);
}
}