Making planets rotate around axis!?<solved>

I need several planets to orbit around the local y-axis so that it appears to rotate. I need to have variable to control how fast it rotates to. I need it in javascript.
So how do i make objects rotate around local axis?

I’m not going to write code for you, but here’s a rough overview. Each GameObject has a Transform object attached to it. The Transform has a method called RotateAround. You’ll probably want to use that. If you’re brand new to unity, you need to do some other tutorials before trying to blindly implement this scene.

Also if you’re completely new to coding, you need to learn some javascript basics before trying to write the game. Try

If you come try to implement things and it doesn’t work as expected, then come back with code that doesn’t work right and people will probably be glad to help you fix it.

Don’t ask us to code a game for you, this is the community Q&A section, we don’t code games for you, we help out with problems.

You can use the localRotation or localEulerAngles to rotate an object on it’s own axis. To have it orbit (revolve) around another axis (as a planet orbits the sun), you would nest the planet into an empty game object, set the X value of the planet to the orbital distance, then rotate that empty object around its Y axis.

Please note if you are trying to do a solar system simulation where planets move like they really do, you need to tilt them (like Earth is 23.something degrees tilted), and in so doing, you need to add more hierarchy and counter-revolution to keep the angle of that tilt the same in the world no matter where the planet is in orbit.

That, or just script it. Or use the Animation Editor

We all want something. However, we never want to do it ourselves. Get a life and learn to write code.

Seriously, we do not work for you. If you are going to demand something like this with that kind of attitude and expect to get anything apart from insults, then hire us.

I have no idea what is causing you to believe that you will get your code by demanding it from us, but it is obviously a very bad influence on your life. I would expect this kind of wording from my employer, assuming that I had one.

Delete your post and try again. That is my only suggestion.