• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Javafx orbit sphere around other sphere like solar system

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello. I'm new here but i very need your help.
I would like to do something like solar system. I have 3 sphere Sun, Earth,Moon
In my code Earth is rotating properly around the Sun, but But the Moon does not want to properly rotate around earth. I dont know why. Can you help me?
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

This looks like it will get better responses in the JavaFX forum, so I moved it there.
 
Greenhorn
Posts: 4
IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I also am new here and new to JavaFX and I happened upon this post when looking for what JavaFX can do and it caught my attention.

I am by no means an expert, I started looking in to JavaFX a little over a week ago and have no prior experience in JavaFX animations.

With that said, with a little testing it seems that you are creating a path for a sphere to follow and then moving that path around, problem seems to be that once an animation has started, it's path cannot be altered, you would need to stop() and play() it after the path has changed and would not work since the path moves around constantly.

Backed with this information I thought that the paths and sphere do move along with the pane they are in.
So I added a new Anchorpane that is bound to the earth spheres location and added the moon into that instead and the result seems to be what you wanted.
I also commented some code that I deemed unnecessary since the path cannot change so there is no need to move it.


There may be alternative methods but this atleast works, hope it helps.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic