Skip to content

Instantly share code, notes, and snippets.

@GT3000
Created April 18, 2021 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GT3000/671261e6ae27964e1720507261002014 to your computer and use it in GitHub Desktop.
Save GT3000/671261e6ae27964e1720507261002014 to your computer and use it in GitHub Desktop.
Simple 3D movement for a sphere
public class Player : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector3 playerPos = new Vector3(-Input.GetAxisRaw("Vertical"),0 , Input.GetAxisRaw("Horizontal"));
GetComponent<Rigidbody>().velocity = playerPos * Time.deltaTime * 100.0f;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment