Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

How do I calculate the position on a circle based on a progress value?

$
0
0

Currently I'm working on a orbit system for a game. I've got it so an object will move along a circle based on a progress value that'll be between 0.0 and 1.0 (0.5 being half way around the circle). I calculate this like this:

float angle = Mathf.Deg2Rad * 360 * t;
float xPos = Mathf.Sin(angle) * xAxis;
float yPos = Mathf.Cos(angle) * yAxis;

return new Vector3(xPos, yPos, 0.0f);

With t simply being deltatime and the xAxis/yAxis variables being the radius of the circle. What I'm a little stuck on currently though …


Viewing all articles
Browse latest Browse all 17560

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>