Advertisement
LeeMace

Orbit Around Object 2

Apr 19th, 2024
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.24 KB | Gaming | 0 0
  1. public float speed = 1f;
  2. public float radius = 5f;
  3.  
  4. void Update() {
  5.     float angle = Time.time * speed;
  6.     float x = Mathf.Cos(angle) * radius;
  7.     float z = Mathf.Sin(angle) * radius;
  8.     transform.position = new Vector3(x, 1, z);
  9. }
Tags: Orbit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement