- Home /
How do I get the opposite position of an object that spins around another object...
So how would I get the opposite of an object that spins in a circle so I can instantiate another object on command? Lets image a planet that is simply spinning around the sun and I wanted to just get the position that when I want the other planet to appear- that it appears directly on the opposite side of the first planet spinning and both are spinning around the sun. Any help would be appreciated. I really just need to know how to get the opposite position of the first planet to be able to make it appear directly across the first planet. Thanks again!
As stated here you can rotate an object around a vector like this:
// Spin the object around the world origin at 20 degrees/second.
transform.RotateAround(Vector3.zero, Vector3.up, 20 * Time.deltaTime);
So if you just instantiate your new object in the exact same place as your currently spinning object and call this method afterwards transform.RotateAround(Vector3.zero, Vector3.up, 180);
it will move just the opposite side of your already spinning object. (But of course you must pass your own vector3 values in the method)
Your answer
Follow this Question
Related Questions
Instantiating road pieces without any spacings between 2 Answers
Instantiating at wrong values 2 Answers
How to spawn object but with child as center of position 0 Answers
GameObject position and localPosition not changing in hiearchy, only in script. 0 Answers
"Object reference not set to an instance of an Object" 0 Answers