Sign in to follow this  
bar10dr

Mesh rotating around itself and around another mesh

Recommended Posts

Hi,

I'm trying to make a planet rotate around itself, and at the same time rotate around a sun.

I do not want to use the sun's rotation to rotate the planet, as it will look strange if the sun is rotating when I apply textures to it.

I made a little example with two cameras that switches every five seconds to convey my problem; as you can see I get the planet to rotate around the sun, but it does not rotate around its own axis.

http://www.babylonjs-playground.com/#6WAD41

 

A push in the right direction would be appreciated :)

Share this post


Link to post
Share on other sites

Hi bar10dr, welcome to the forum.

Sometimes people position an invisible box/plane inside the sun... as a parent for the orbiting things.

Then the sun can rotate however it chooses, and so can the orbiters.

If there are many orbiting planets at different orbit speeds, then you can make a separate invisible "orbit pivot" for each planet.

http://www.babylonjs-playground.com/#6WAD41#1

Does that look better?  There may be other ways to do it, but invisible planet-parents work pretty well.  Each planet-parent can rotate a tiny amount, too, so you can have non-equatorial orbit paths.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.