diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d468ae..ac7c665 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -115,19 +115,32 @@ jobs: - uses: olegtarasov/get-tag@v2.1.2 id: get_version - uses: actions/checkout@v4 + with: + submodules: true - uses: dtolnay/rust-toolchain@stable with: targets: x86_64-pc-windows-msvc + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'adopt' - name: Build run: | cargo build --release --target x86_64-pc-windows-msvc + + - name: Build Horizon Ui + run: | + .\horizon-ui\gradlew obfuscate - name: Prepare package run: | mkdir windows cp target/x86_64-pc-windows-msvc/release/${{ env.binary }}.exe windows/ cp -r assets windows/ + cp .\horizon-ui\build\compose\jars\horizon-ui-windows-x64-1.0.0.min.jar windows/horizon-ui.jar - name: Package as a zip run: | diff --git a/assets/bodies.sim b/assets/bodies.sim index cbec24e..e47aa13 100644 --- a/assets/bodies.sim +++ b/assets/bodies.sim @@ -1 +1 @@ -{"bodies":[{"data":{"mass":1.9885E30,"starting_position":{"x":-1253558.344523507,"y":-331931.4431501561,"z":31972.046837662},"starting_velocity":{"x":0.006931107133912123,"y":-0.01362000313964326,"z":-4.54388831820406E-5},"name":"Sun","model_path":"sun.glb","diameter":1392000.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[{"data":{"mass":5.97219E24,"starting_position":{"x":1.47358878457139E8,"y":1.854315256927273E7,"z":29904.29803438578},"starting_velocity":{"x":-4.226365231723641,"y":29.41379349033467,"z":-0.002828583292782128},"name":"Earth","model_path":"earth.glb","diameter":12742.0,"rotation_speed":1436.0,"axial_tilt":23.4392811},"children":[{"data":{"mass":7.348E22,"starting_position":{"x":1.4768044919678E8,"y":1.872052246844263E7,"z":32437.75744153466},"starting_velocity":{"x":-4.694794112410923,"y":30.37390017058626,"z":0.09549595923954257},"name":"Luna","model_path":"moon.glb","diameter":1738.1,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":5.6834E26,"starting_position":{"x":1.317721699784666E9,"y":-6.263762138853518E8,"z":-4.157355925955266E7},"starting_velocity":{"x":3.608323540191913,"y":8.705880483493228,"z":-0.2953903588682212},"name":"Saturn","model_path":"saturn.glb","diameter":116464.0,"rotation_speed":633.0,"axial_tilt":26.73},"children":[{"data":{"mass":1.3452E23,"starting_position":{"x":1.317062395789841E9,"y":-6.254109541976979E8,"z":-4.200566301576936E7},"starting_velocity":{"x":-1.060852998165573,"y":6.402666517530363,"z":1.357634287951674},"name":"Titan","model_path":"titan.glb","diameter":5149.46,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":2.3064854E21,"starting_position":{"x":1.317198227126551E9,"y":-6.263121286545614E8,"z":-4.155952859529075E7},"starting_velocity":{"x":2.806558904291587,"y":1.2701482567137,"z":3.694364144037066},"name":"Rhea","model_path":"rhea.glb","diameter":763.5,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.8056591E21,"starting_position":{"x":1.320855160609993E9,"y":-6.278521340465181E8,"z":-4.186440417667893E7},"starting_velocity":{"x":4.854646792968393,"y":11.66248870085356,"z":-1.230081930411274},"name":"Iapetus","model_path":"iapetus.glb","diameter":1470.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.0954867999999999E21,"starting_position":{"x":1.318063919760553E9,"y":-6.26526636509911E8,"z":-4.152808612631324E7},"starting_velocity":{"x":7.705841565764674,"y":16.66690708035977,"z":-4.861168661971909},"name":"Dione","model_path":"dione.glb","diameter":1123.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":6.174959E20,"starting_position":{"x":1.317498514533114E9,"y":-6.261968167390172E8,"z":-4.164324520863017E7},"starting_velocity":{"x":-3.711987600444088,"y":1.440318005837302,"z":4.443003247932851},"name":"Tethys","model_path":"tethys.glb","diameter":1062.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":3.75094E19,"starting_position":{"x":1.317862368973109E9,"y":-6.262736478866278E8,"z":-4.163625521668619E7},"starting_velocity":{"x":-5.466336813759373,"y":18.80368314533501,"z":-4.960595064530139},"name":"Mimas","model_path":"mimas.glb","diameter":396.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.080318E20,"starting_position":{"x":1.317897357123477E9,"y":-6.265236953599699E8,"z":-4.15133347885673E7},"starting_velocity":{"x":12.03172552201499,"y":16.74134008425769,"z":-5.324491936368194},"name":"Enceladus","model_path":"enceladus.glb","diameter":504.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":1.8982E27,"starting_position":{"x":5.91116405042928E8,"y":4.48612773658671E8,"z":-1.508610682481316E7},"starting_velocity":{"x":-8.045068878300311,"y":11.02381638213635,"z":0.1341531152888358},"name":"Jupiter","model_path":"jupiter.glb","diameter":139822.0,"rotation_speed":595.0,"axial_tilt":3.13},"children":[{"data":{"mass":8.931938E22,"starting_position":{"x":5.910424467821088E8,"y":4.481963687394117E8,"z":-1.510185010929203E7},"starting_velocity":{"x":8.957736595686779,"y":7.959026250920237,"z":0.2787009746093063},"name":"Io","model_path":"io.glb","diameter":3643.2,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":4.799844E22,"starting_position":{"x":5.917799042824603E8,"y":4.486983281930672E8,"z":-1.506823606685701E7},"starting_velocity":{"x":-9.693151465294227,"y":24.69741639214316,"z":0.569429680046083},"name":"Europa","model_path":"europa.glb","diameter":1560.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.4819E23,"starting_position":{"x":5.920393829735433E8,"y":4.480741128331422E8,"z":-1.509370908536822E7},"starting_velocity":{"x":-2.558462326557859,"y":20.43120719962253,"z":0.5697972593813327},"name":"Ganymede","model_path":"ganymede.glb","diameter":5268.2,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.075938E23,"starting_position":{"x":5.928184462926141E8,"y":4.478344900349652E8,"z":-1.508781974881226E7},"starting_velocity":{"x":-4.643871215581399,"y":18.53965996642426,"z":0.4153266498041814},"name":"Callisto","model_path":"callisto.glb","diameter":4820.6,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":4.8675E24,"starting_position":{"x":8.476483460935698E7,"y":6.527795533113867E7,"z":-4030295.749102697},"starting_velocity":{"x":-21.33838684070412,"y":27.68230884313838,"z":1.611943339470342},"name":"Venus","model_path":"venus.glb","diameter":12103.6,"rotation_speed":349946.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":3.3011E23,"starting_position":{"x":-2.65823594034951E7,"y":4.047607508223532E7,"z":5690109.263829736},"starting_velocity":{"x":-51.19740738494808,"y":-23.82829179403439,"z":2.750476586235273},"name":"Mercury","model_path":"mercury.glb","diameter":4880.0,"rotation_speed":84480.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":8.681E25,"starting_position":{"x":1.876848145196212E9,"y":2.256742495428547E9,"z":-1.593333878791571E7},"starting_velocity":{"x":-5.285944969180821,"y":4.037177487005098,"z":0.0832885977451503},"name":"Uranus","model_path":"uranus.glb","diameter":50724.0,"rotation_speed":1034.0,"axial_tilt":0.0},"children":[{"data":{"mass":6.4E19,"starting_position":{"x":1.876793591976653E9,"y":2.256780204161452E9,"z":-1.582184453453541E7},"starting_velocity":{"x":0.5593250277603632,"y":3.223358609129066,"z":3.227082066969737},"name":"Miranda","model_path":"miranda.glb","diameter":471.6,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.251E21,"starting_position":{"x":1.87669550752492E9,"y":2.256760167205151E9,"z":-1.604669083471954E7},"starting_velocity":{"x":-8.385308784191833,"y":5.318928951790138,"z":4.453089305595049},"name":"Ariel","model_path":"ariel.glb","diameter":1157.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.275E21,"starting_position":{"x":1.877032097119599E9,"y":2.256677176877903E9,"z":-1.611531210892296E7},"starting_velocity":{"x":-8.506198828430891,"y":4.275436104814067,"z":-3.265378937492151},"name":"Umbriel","model_path":"umbriel.glb","diameter":1169.4,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":3.4E21,"starting_position":{"x":1.876446721049093E9,"y":2.256849468855134E9,"z":-1.579768942792165E7},"starting_velocity":{"x":-4.077764161868127,"y":4.250690343060523,"z":3.508220529443759},"name":"Titania","model_path":"titania.glb","diameter":1576.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":3.076E21,"starting_position":{"x":1.876691132612216E9,"y":2.256854991280804E9,"z":-1.538266894913125E7},"starting_velocity":{"x":-2.324170074400168,"y":3.526797505106853,"z":1.030057319525953},"name":"Oberon","model_path":"oberon.glb","diameter":1522.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":1.024E26,"starting_position":{"x":4.46073781433013E9,"y":-3.117194956197202E8,"z":-9.638308729856475E7},"starting_velocity":{"x":0.3424898338191547,"y":5.454448402599064,"z":-0.1196973250551823},"name":"Neptune","model_path":"neptune.glb","diameter":49244.0,"rotation_speed":960.0,"axial_tilt":28.32},"children":[{"data":{"mass":2.139E22,"starting_position":{"x":4.46043565553476E9,"y":-3.118210796191955E8,"z":-9.622740008927625E7},"starting_velocity":{"x":0.6549830743821887,"y":8.816651890055235,"z":2.683376921837763},"name":"Triton","model_path":"triton.glb","diameter":2706.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":1.303E22,"starting_position":{"x":2.534605027840262E9,"y":-4.550728311952005E9,"z":-2.46201602553565E8},"starting_velocity":{"x":4.90550581768183,"y":1.466573354685091,"z":-1.58125012378935},"name":"Pluto","model_path":"pluto.glb","diameter":2376.6,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":6.4171E23,"starting_position":{"x":-2.046893400400904E8,"y":-1.250136923437167E8,"z":2409131.185058415},"starting_velocity":{"x":13.57395490411145,"y":-18.60254221026088,"z":-0.7224152414868863},"name":"Mars","model_path":"mars.glb","diameter":6779.0,"rotation_speed":1476.0,"axial_tilt":25.19},"children":[{"data":{"mass":1.0659E16,"starting_position":{"x":-2.046811201572424E8,"y":-1.250112401183025E8,"z":2405122.029878475},"starting_velocity":{"x":13.1724712527701,"y":-16.55773129437739,"z":-0.3519634910822811},"name":"Phobos","model_path":"phobos.glb","diameter":22.16,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.4762E15,"starting_position":{"x":-2.046898065944895E8,"y":-1.24990331767902E8,"z":2411141.282914884},"starting_velocity":{"x":12.33964871357277,"y":-18.67418157402109,"z":-0.1763597828023391},"name":"Deimos","model_path":"deimos.glb","diameter":12.54,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":9.38392E20,"starting_position":{"x":-2.762371221893816E8,"y":-2.903518150199021E8,"z":4.151164079416633E7},"starting_velocity":{"x":12.07056566717051,"y":-13.70357563530193,"z":-2.655445328553542},"name":"Ceres","model_path":"ceres.glb","diameter":939.4,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.6466E22,"starting_position":{"x":1.280400740948511E10,"y":5.796599006941406E9,"z":-2.733004417387743E9},"starting_velocity":{"x":-0.7745567938606255,"y":1.50385470985689,"z":1.614258646777714},"name":"Eris","model_path":"eris.glb","diameter":2326.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]}],"starting_time_millis":1697645687241} \ No newline at end of file +{"bodies":[{"data":{"mass":1.9885E30,"starting_position":{"x":-1253558.344523507,"y":-331931.4431501561,"z":31972.046837662},"starting_velocity":{"x":0.006931107133912123,"y":-0.01362000313964326,"z":-4.54388831820406E-5},"name":"Sun","model_path":"sun.glb","diameter":1392000.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[{"data":{"mass":5.97219E24,"starting_position":{"x":1.47358878457139E8,"y":1.854315256927273E7,"z":29904.29803438578},"starting_velocity":{"x":-4.226365231723641,"y":29.41379349033467,"z":-0.002828583292782128},"name":"Earth","model_path":"earth.glb","diameter":12742.0,"rotation_speed":1436.0,"axial_tilt":23.4392811},"children":[{"data":{"mass":7.348E22,"starting_position":{"x":1.4768044919678E8,"y":1.872052246844263E7,"z":32437.75744153466},"starting_velocity":{"x":-4.694794112410923,"y":30.37390017058626,"z":0.09549595923954257},"name":"Luna","model_path":"moon.glb","diameter":1738.1,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":5.6834E26,"starting_position":{"x":1.317721699784666E9,"y":-6.263762138853518E8,"z":-4.157355925955266E7},"starting_velocity":{"x":3.608323540191913,"y":8.705880483493228,"z":-0.2953903588682212},"name":"Saturn","model_path":"saturn.glb","diameter":116464.0,"rotation_speed":633.0,"axial_tilt":26.73},"children":[{"data":{"mass":1.3452E23,"starting_position":{"x":1.317062395789841E9,"y":-6.254109541976979E8,"z":-4.200566301576936E7},"starting_velocity":{"x":-1.060852998165573,"y":6.402666517530363,"z":1.357634287951674},"name":"Titan","model_path":"titan.glb","diameter":5149.46,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":2.3064854E21,"starting_position":{"x":1.317198227126551E9,"y":-6.263121286545614E8,"z":-4.155952859529075E7},"starting_velocity":{"x":2.806558904291587,"y":1.2701482567137,"z":3.694364144037066},"name":"Rhea","model_path":"rhea.glb","diameter":763.5,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.8056591E21,"starting_position":{"x":1.320855160609993E9,"y":-6.278521340465181E8,"z":-4.186440417667893E7},"starting_velocity":{"x":4.854646792968393,"y":11.66248870085356,"z":-1.230081930411274},"name":"Iapetus","model_path":"iapetus.glb","diameter":1470.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.0954867999999999E21,"starting_position":{"x":1.318063919760553E9,"y":-6.26526636509911E8,"z":-4.152808612631324E7},"starting_velocity":{"x":7.705841565764674,"y":16.66690708035977,"z":-4.861168661971909},"name":"Dione","model_path":"dione.glb","diameter":1123.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":6.174959E20,"starting_position":{"x":1.317498514533114E9,"y":-6.261968167390172E8,"z":-4.164324520863017E7},"starting_velocity":{"x":-3.711987600444088,"y":1.440318005837302,"z":4.443003247932851},"name":"Tethys","model_path":"tethys.glb","diameter":1062.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":3.75094E19,"starting_position":{"x":1.317862368973109E9,"y":-6.262736478866278E8,"z":-4.163625521668619E7},"starting_velocity":{"x":-5.466336813759373,"y":18.80368314533501,"z":-4.960595064530139},"name":"Mimas","model_path":"mimas.glb","diameter":396.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.080318E20,"starting_position":{"x":1.317897357123477E9,"y":-6.265236953599699E8,"z":-4.15133347885673E7},"starting_velocity":{"x":12.03172552201499,"y":16.74134008425769,"z":-5.324491936368194},"name":"Enceladus","model_path":"enceladus.glb","diameter":504.0,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":1.8982E27,"starting_position":{"x":5.91116405042928E8,"y":4.48612773658671E8,"z":-1.508610682481316E7},"starting_velocity":{"x":-8.045068878300311,"y":11.02381638213635,"z":0.1341531152888358},"name":"Jupiter","model_path":"jupiter.glb","diameter":139822.0,"rotation_speed":595.0,"axial_tilt":3.13},"children":[{"data":{"mass":8.931938E22,"starting_position":{"x":5.910424467821088E8,"y":4.481963687394117E8,"z":-1.510185010929203E7},"starting_velocity":{"x":8.957736595686779,"y":7.959026250920237,"z":0.2787009746093063},"name":"Io","model_path":"io.glb","diameter":3643.2,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":4.799844E22,"starting_position":{"x":5.917799042824603E8,"y":4.486983281930672E8,"z":-1.506823606685701E7},"starting_velocity":{"x":-9.693151465294227,"y":24.69741639214316,"z":0.569429680046083},"name":"Europa","model_path":"europa.glb","diameter":1560.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.4819E23,"starting_position":{"x":5.920393829735433E8,"y":4.480741128331422E8,"z":-1.509370908536822E7},"starting_velocity":{"x":-2.558462326557859,"y":20.43120719962253,"z":0.5697972593813327},"name":"Ganymede","model_path":"ganymede.glb","diameter":5268.2,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.075938E23,"starting_position":{"x":5.928184462926141E8,"y":4.478344900349652E8,"z":-1.508781974881226E7},"starting_velocity":{"x":-4.643871215581399,"y":18.53965996642426,"z":0.4153266498041814},"name":"Callisto","model_path":"callisto.glb","diameter":4820.6,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":4.8675E24,"starting_position":{"x":8.476483460935698E7,"y":6.527795533113867E7,"z":-4030295.749102697},"starting_velocity":{"x":-21.33838684070412,"y":27.68230884313838,"z":1.611943339470342},"name":"Venus","model_path":"venus.glb","diameter":12103.6,"rotation_speed":349946.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":3.3011E23,"starting_position":{"x":-2.65823594034951E7,"y":4.047607508223532E7,"z":5690109.263829736},"starting_velocity":{"x":-51.19740738494808,"y":-23.82829179403439,"z":2.750476586235273},"name":"Mercury","model_path":"mercury.glb","diameter":4880.0,"rotation_speed":84480.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":8.681E25,"starting_position":{"x":1.876848145196212E9,"y":2.256742495428547E9,"z":-1.593333878791571E7},"starting_velocity":{"x":-5.285944969180821,"y":4.037177487005098,"z":0.0832885977451503},"name":"Uranus","model_path":"uranus.glb","diameter":50724.0,"rotation_speed":1034.0,"axial_tilt":0.0},"children":[{"data":{"mass":6.4E19,"starting_position":{"x":1.876793591976653E9,"y":2.256780204161452E9,"z":-1.582184453453541E7},"starting_velocity":{"x":0.5593250277603632,"y":3.223358609129066,"z":3.227082066969737},"name":"Miranda","model_path":"miranda.glb","diameter":471.6,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.251E21,"starting_position":{"x":1.87669550752492E9,"y":2.256760167205151E9,"z":-1.604669083471954E7},"starting_velocity":{"x":-8.385308784191833,"y":5.318928951790138,"z":4.453089305595049},"name":"Ariel","model_path":"ariel.glb","diameter":1157.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.275E21,"starting_position":{"x":1.877032097119599E9,"y":2.256677176877903E9,"z":-1.611531210892296E7},"starting_velocity":{"x":-8.506198828430891,"y":4.275436104814067,"z":-3.265378937492151},"name":"Umbriel","model_path":"umbriel.glb","diameter":1169.4,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":3.4E21,"starting_position":{"x":1.876446721049093E9,"y":2.256849468855134E9,"z":-1.579768942792165E7},"starting_velocity":{"x":-4.077764161868127,"y":4.250690343060523,"z":3.508220529443759},"name":"Titania","model_path":"titania.glb","diameter":1576.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":3.076E21,"starting_position":{"x":1.876691132612216E9,"y":2.256854991280804E9,"z":-1.538266894913125E7},"starting_velocity":{"x":-2.324170074400168,"y":3.526797505106853,"z":1.030057319525953},"name":"Oberon","model_path":"oberon.glb","diameter":1522.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":1.024E26,"starting_position":{"x":4.46073781433013E9,"y":-3.117194956197202E8,"z":-9.638308729856475E7},"starting_velocity":{"x":0.3424898338191547,"y":5.454448402599064,"z":-0.1196973250551823},"name":"Neptune","model_path":"neptune.glb","diameter":49244.0,"rotation_speed":960.0,"axial_tilt":28.32},"children":[{"data":{"mass":2.139E22,"starting_position":{"x":4.46043565553476E9,"y":-3.118210796191955E8,"z":-9.622740008927625E7},"starting_velocity":{"x":0.6549830743821887,"y":8.816651890055235,"z":2.683376921837763},"name":"Triton","model_path":"triton.glb","diameter":2706.8,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":1.303E22,"starting_position":{"x":2.534605027840262E9,"y":-4.550728311952005E9,"z":-2.46201602553565E8},"starting_velocity":{"x":4.90550581768183,"y":1.466573354685091,"z":-1.58125012378935},"name":"Pluto","model_path":"pluto.glb","diameter":2376.6,"rotation_speed":9201.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":6.4171E23,"starting_position":{"x":-2.046893400400904E8,"y":-1.250136923437167E8,"z":2409131.185058415},"starting_velocity":{"x":13.57395490411145,"y":-18.60254221026088,"z":-0.7224152414868863},"name":"Mars","model_path":"mars.glb","diameter":6779.0,"rotation_speed":1476.0,"axial_tilt":25.19},"children":[{"data":{"mass":1.0659E16,"starting_position":{"x":-2.046811201572424E8,"y":-1.250112401183025E8,"z":2405122.029878475},"starting_velocity":{"x":13.1724712527701,"y":-16.55773129437739,"z":-0.3519634910822811},"name":"Phobos","model_path":"phobos.glb","diameter":22.16,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.4762E15,"starting_position":{"x":-2.046898065944895E8,"y":-1.24990331767902E8,"z":2411141.282914884},"starting_velocity":{"x":12.33964871357277,"y":-18.67418157402109,"z":-0.1763597828023391},"name":"Deimos","model_path":"deimos.glb","diameter":12.54,"rotation_speed":0.0,"axial_tilt":0.0},"children":[]}]},{"data":{"mass":9.38392E20,"starting_position":{"x":-2.762371221893816E8,"y":-2.903518150199021E8,"z":4.151164079416633E7},"starting_velocity":{"x":12.07056566717051,"y":-13.70357563530193,"z":-2.655445328553542},"name":"Ceres","model_path":"ceres.glb","diameter":939.4,"rotation_speed":540.0,"axial_tilt":0.0},"children":[]},{"data":{"mass":1.6466E22,"starting_position":{"x":1.280400740948511E10,"y":5.796599006941406E9,"z":-2.733004417387743E9},"starting_velocity":{"x":-0.7745567938606255,"y":1.50385470985689,"z":1.614258646777714},"name":"Eris","model_path":"eris.glb","diameter":2326.0,"rotation_speed":1554.0,"axial_tilt":0.0},"children":[]}]}],"starting_time_millis":1697654022096} \ No newline at end of file diff --git a/horizon-ui b/horizon-ui index 177900d..396aaa1 160000 --- a/horizon-ui +++ b/horizon-ui @@ -1 +1 @@ -Subproject commit 177900dce8c2c10da69b17eae2a3756ae9ebd13b +Subproject commit 396aaa105dc373a48aeee6106b9cfaedd8e8517a diff --git a/src/main.rs b/src/main.rs index c20f168..3b5ee0a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,7 +77,7 @@ fn main() { ..default() }) ) - .add_plugins(WorldInspectorPlugin::new()) + // .add_plugins(WorldInspectorPlugin::new()) // .add_plugins(DefaultPickingPlugins) .add_plugins(LockOnPlugin) .add_plugins(SerializationPlugin) diff --git a/src/rotation.rs b/src/rotation.rs index c7f693f..7257767 100644 --- a/src/rotation.rs +++ b/src/rotation.rs @@ -66,8 +66,8 @@ fn rotate_bodies( let rotation_duration = rotation_speed.0 * 60.0; let rotations_per_day = DAY_IN_SECONDS / (rotation_duration as f32); - transform.rotate_axis(axis.axis.unwrap(), 2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier)); - // transform.rotate_z(2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier)); + // transform.rotate_axis(axis.axis.unwrap(), 2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier)); + transform.rotate_z(2.0 * PI * (rotations_per_day * time.delta_seconds() * speed_modifier)); } } diff --git a/src/selection.rs b/src/selection.rs index 89bb100..8162fc5 100644 --- a/src/selection.rs +++ b/src/selection.rs @@ -1,9 +1,7 @@ use bevy::app::{App, Plugin, Update}; -use bevy::prelude::{in_state, Query, Transform, Resource, Entity, With, ResMut, IntoSystemConfigs, Vec3}; +use bevy::prelude::{in_state, Query, Transform, Resource, Entity, With, ResMut, IntoSystemConfigs}; use crate::SimState; -use crate::body::Mass; -use crate::pan_orbit::lib::PanOrbitCamera; -use crate::physics::update_position; +use crate::body::{Mass, Star}; pub struct SelectionPlugin; @@ -11,8 +9,8 @@ impl Plugin for SelectionPlugin { fn build(&self, app: &mut App) { app - .init_resource::(); - // .add_systems(Update, (apply_camera_to_selection.after(update_position)).run_if(in_state(SimState::Simulation))); + .init_resource::() + .add_systems(Update, (apply_camera_to_selection).run_if(in_state(SimState::Simulation))); } } @@ -21,17 +19,19 @@ impl Plugin for SelectionPlugin { pub struct SelectedEntity(pub Option); pub fn apply_camera_to_selection( - mut camera: Query<&mut PanOrbitCamera>, - bodies: Query<(&Transform, With)>, + bodies: Query<(Entity, &Transform, With, Option<&Star>)>, mut selected_entity: ResMut ) { - let mut camera = camera.single_mut(); if let Some(entity) = selected_entity.0 { - if let Ok((transform, _)) = bodies.get(entity) { - // camera.target_focus = Vec3::ZERO; - // camera.force_update = true; - } else { - selected_entity.0 = None; + if let Err(_) = bodies.get(entity) { + selected_entity.0 = None; + } + } else { + println!("hi??"); + if let Some((entity, _, _, _)) = bodies.iter().find(|(_, _, _, maybe_star)| { + maybe_star.is_some() + }) { + selected_entity.0 = Some(entity); } } } \ No newline at end of file diff --git a/src/ui.rs b/src/ui.rs index ac06b32..fe471bf 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -44,7 +44,7 @@ pub struct UIPlugin; impl Plugin for UIPlugin { fn build(&self, app: &mut App) { app - //.add_plugins(EguiPlugin) + .add_plugins(EguiPlugin) .init_resource::() .register_type::() .init_resource::()