Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

FX Planet Orbit

Discussion in 'Made With Unity' started by ForceX, Jul 17, 2011.

  1. BoydofZINJ

    BoydofZINJ

    Joined:
    Feb 22, 2014
    Posts:
    6
    Is there a reason you have not added this to the Asset store (for free or a small price) ?
     
  2. Deadphyre

    Deadphyre

    Joined:
    Sep 26, 2013
    Posts:
    21
    Hey, I'm not sure if this is being worked on anymore but I found it awesome. I did convert the scripts over to C# for people who use that instead of JS and will upload it. The scripts were renamed so I could keep track of them but you can change them back, just edit the file name in the editor script.

    Also, Thanks a Ton to the original creator. You saved me a ton of time on working on something similar but I wasn't sure how to go about it. I bow down to you!
     

    Attached Files:

  3. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    How do i use this?
    when ever i try to make a planet orbit the sun it spins in a small circle inside of the sun and when i move it out it still spins in its own little circle
     
  4. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    You need to set the orbit distance in the Inspector. I could update the script to allow the placing of objects at a desired distance in the scene view.
     
    Last edited: Sep 7, 2014
  5. Valiant

    Valiant

    Joined:
    May 26, 2013
    Posts:
    2
    At the risk of resurrecting a slightly old thread, did you start on this in the end?

    I would absolutely love this functionality as it'd pretty much allow me to drag and drop your system into the space "map" I have already laid out in the scene. I've tried wrapping my head around it myself but I don't have enough brain matter. ;)

    I'm working with over 300+ objects so not having to go through each one and slowly adjust the distance settings one by one until they match their original positions would be a lifesaver.


    Edit: Nevermind! After I stopped being a total idiot I realised a nice simple way to do this. :oops: I'd be dangerous if I had a brain.

    Your system has saved me a whole heap of time and stress as well as teaching me a load of useful techniques, so thanks for putting this up here. :D
     
    Last edited: Oct 22, 2014
  6. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Glad you got it working for you. I have not looked at this script is some time. I do remember re-working it in the past wondering to myself "why did I do that?” I suppose that’s what happens as you learn new things :). Sadly I lost that build. Right now I’m not doing much Unity work but seeing as this was the second script I released, it may be fun to revise it into C#.
     
    Valiant likes this.
  7. Valiant

    Valiant

    Joined:
    May 26, 2013
    Posts:
    2
    I'm actually really enjoying using it now that I've dug into it a bit and figured out how it all fits together. Already tailored it nicely to my purposes without any real headaches, as well as making a little secondary script which is helping me go through and set up all 300+ objects with a little automation for some of the more standardised options. :D

    I was initially worried about muddling of my object hierarchy but it actually turned out to be fairly quick and easy to rework my existing systems to be less hierarchy dependent than trying to figure out how to rework the orbit stuff to leave it in tact.

    Anyway, it's turned out to be a really nice script that has added a lovely bit of polish and flare to my otherwise ham-fisted project. For which I am forever grateful. :)
     
  8. Kirkules_

    Kirkules_

    Joined:
    Aug 5, 2014
    Posts:
    65
    Has anyone used this to setup a simulation of our solar system?
     
  9. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    This will not provide an exact gravimetric simulation of our solar system. Because this script simulates orbiting bodies with the use of transform rotations via speed & deltaTime, so any speed variations based on the distance to the parent mass is not calculated. This also means all orbits are circular not elliptical.

    However you can take real world data such as the amount of time it takes Saturn to orbit the sun and use that data to drive your simulations, the orbit path will be circular but you can offset the center and rotate the angle of the orbit so that the orbiting body will not be perfectly centered around the parent mass.
     
  10. Kirkules_

    Kirkules_

    Joined:
    Aug 5, 2014
    Posts:
    65
    Thanks for the response. I know how to do it, just wondering if anyone has done it yet so I don't have to reinvent the solar wheel so to speak.

    I'm also not that concerned with exact orbits, etc. I'm simply looking for general body orientation 'correctness' like having the moon always face the proper direction when seen from earth.. and relative position around the sun for given date of any planet or their moons. I'm going to use an open source tool for calculating these things, and I may or may not continue to use your planet orbit scripts. I do already have the sun and planets in a scene to scale, and can fly around in space.
     
  11. Andy182

    Andy182

    Joined:
    Nov 22, 2014
    Posts:
    1
    Has anyone help me to find the latest version of fx-planet-orbit script? where can i download it?
     
  12. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    The only available version is on the front page.
     
  13. alexandrecrpm

    alexandrecrpm

    Joined:
    Feb 11, 2016
    Posts:
    1
    Hello,

    I wonder how I can fix the direction of a spherical object, which has a certain inclination, and that is rotating around a point. I am What did wanting: The planet earth has an inclination (precession), say 25 degrees, and while rotating and around the sun, this inclination is always pointed in a single direction (let's assume for the north of the solar system) this phenomenon which causes the seasons there.

    However when I put some angle on the axis of the earth, to simulate the angle of precession, this angle is always pointing to the center of the orbit (in this case the sun), what it is not correct, the correct is this angle in the earth's axis being pointed in a certain direction, regardless of their position in orbit.

    Any idea to solve the problem?

    Example: Direction of precession during obrita earth: https://c.tadst.com/gfx/600x400/earth-seasons.png


    One more thing, hahaha

    When I start the game, he creates objects called "OrbitCenter" and "Orbits" in the project root. I am making an application using augmented reality. And to run this application objects must be hierarchically below the augmented reality camera. How do I get objects "OrbitCenter" and "Orbits" be created as children of the augmented reality directory.

    Thank you, your work was exelente.
     
  14. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Woo blast from the past LOL :)

    I understand what you are wanting to do but unfortunately this isn't a scientific style simulation and as it is now is not possible. Sorry.

    You can edit the Awake() look at line 77 and 87. This is where the OrbitCenter and Orbits get created. Any point after they have been created you can add a new line to set there parent to what ever you need.

    Something like this at the end of Awake().
    OrbitCenter.transform.parent = my object.transform;
    Orbits.transform.parent = my object.transform;