- Home /
Change orbit while rotating.
I am having a trouble related to coding a math logic in unity. What I want is this - Imagine a planetary orbit system, so our character is revolving around a center in an orbit of radius 2units for example, What I want is that on press of a button it goes to the other orbit whose radius is different, for example 4 units from the centre...and so on. I am using transform.rotateAround for this rotation behavior. How should I make the main object change orbits and still keep rotating around the center object.
Answer by AshAbeAdd · Jun 20, 2017 at 09:44 AM
I think I get what you're saying. Have you thought about having a Gameobject RotateHere; prototype? That way you could probably add to your transform. I would think it would go something like this.transform.rotateAround= RotateHere.transform.position; Where this is the character?
Answer by toddisarockstar · Jun 20, 2017 at 02:20 PM
to make an "orbit" you would have a parent object in the center spinning and make the planets children of the object spinning in the center(where the sun would be). if you wanted different orbits, you would simply have multiple objects set up to spin in the center in different ways and then simply change the parenting of the planet objects !!!!
the objects in the center to represent "orbits" would pry be new empty game objects so the user wouldn't see them.
Your answer
Follow this Question
Related Questions
Smooth Camera Rotation relative to World [SOLVED] 1 Answer
Transform.RotateAround(Vector3 axis, float angle) - what happens with only two arguments? 3 Answers
What's with this absurd index array input? 1 Answer
Translating Speed into rotation degress\sec 1 Answer
How to create a changing orbit from elliptical to planar and back? 0 Answers