Jump to content

Mesh rotating around itself and around another mesh


bar10dr
 Share

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 :)

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...