Lower Limit to Transform.RotateAround?
I've got a pretty simple setup where I use transform.Rotate around to get a collection of objects to orbit a central point and it works well. I'm dividing the angle by an orbitalPeriod value to control the speed but I've noticed that after a certain point, that speed seems to hit a lower limit and can't slow down any faster. I'm assuming this is related to float precision?
Example code:
ObjA float orbitalPeriod = 465.5f; transform.RotateAround(Vector3.zero, Vector3.up, (2 * Mathf.PI / orbitalPeriod) + Time.deltaTime);
ObjB float orbitalPeriod = 4331; transform.RotateAround(Vector3.zero, Vector3.up, ((2 * Mathf.PI) / orbitalPeriod) + Time.deltaTime);
ObjC float orbitalPeriod = 10747; transform.RotateAround(Vector3.zero, Vector3.up, (2 * Mathf.PI / orbitalPeriod) + Time.deltaTime);
Result: ObjA orbits faster around the origin, but ObjB and C move at the same speed, even though C's rotation is be divided by a larger amount.
My first thought for a work around would be to just use Mathf on transform.position instead, but rotateAround is such a simple and easy to control solution.
Ideas?
Answer by brandondavis · Aug 30, 2016 at 05:14 PM
Ah...never mind. It looks like there's a "wind-up" of sorts. Once I let the scene run out for a while, the different rotational speeds become clear.
Your answer
![](https://koobas.hobune.stream/wayback/20220612091849im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Why aint my gameObject(the one i aplied the script) moving? 1 Answer
Help in C# rotatearound is not around center object 0 Answers
Problems with camera orbiting the player based on mouse input (C#) 0 Answers
[C#] 2D elliptical Orbit - Non incrementing Variable 2 Answers
Standalone build rotation shuddering with input button 0 Answers