Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karth42/simplekeplerorbits
Unity3d static 2-body orbits simulation
https://github.com/karth42/simplekeplerorbits
celestial gravity kepler orbit orbital-mechanics orbits simulation space space-game space-physics unity unity3d unity3d-plugin
Last synced: about 2 months ago
JSON representation
Unity3d static 2-body orbits simulation
- Host: GitHub
- URL: https://github.com/karth42/simplekeplerorbits
- Owner: Karth42
- License: mit
- Created: 2017-08-12T16:36:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-05T16:05:34.000Z (almost 3 years ago)
- Last Synced: 2024-11-10T19:35:45.532Z (about 2 months ago)
- Topics: celestial, gravity, kepler, orbit, orbital-mechanics, orbits, simulation, space, space-game, space-physics, unity, unity3d, unity3d-plugin
- Language: C#
- Homepage:
- Size: 5.93 MB
- Stars: 100
- Watchers: 7
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SimpleKeplerOrbits
![gif](https://i.imgur.com/0dhq9kL.gif)
## Description
Unity3d project for simulating simple orbits using 2-body solution model.
## Importing
This repository contains the entire Unity Project for basic demo setup.
There are several ways to import the project:
- Manually copy all files from Asset directory to your unity project directory;
- Import asset store package;
- Import of the 'src' branch as [embedded package](https://docs.unity3d.com/Manual/CustomPackages.html#EmbedMe).## Usage
This plugin has the ability to customize orbits using the editor inspector and scripts.
Some scripting usage examples:#### Initializing orbit from orbit elements (JPL database supported)
```cs
var body = GetComponent();
body.AttractorSettings.AttractorObject = attractorTransform;
body.AttractorSettings.AttractorMass = attractorMass;
body.AttractorSettings.GravityConstant = GConstant;
body.OrbitData = new KeplerOrbitData(
eccentricity: eValue,
semiMajorAxis: aValue,
meanAnomalyDeg: mValue,
inclinationDeg: inValue,
argOfPerifocus: wValue,
ascendingNodeDeg: omValue,
attractorMass: attractorMass,
gConst: GConstant);
body.ForceUpdateViewFromInternalState();
```#### Initializing orbit from orbit vectors
```cs
var body = GetComponent();
body.AttractorSettings.AttractorObject = attractorTransform;
body.AttractorSettings.AttractorMass = attractorMass;
body.AttractorSettings.GravityConstant = GConstant;
body.OrbitData = new KeplerOrbitData(
position: bodyPosition,
velocity: bodyVelocity,
attractorMass: attractorMass,
gConst: GConstant);
body.ForceUpdateViewFromInternalState();
```For more detailed scripting snippets go to the [included manual](Assets/SimpleKeplerOrbits/Readme.md).
## Contributing
This repository is closed for contributions.
## Published version
[Unity Asset Store]
[Unity Asset Store]: https://assetstore.unity.com/packages/tools/physics/simple-kepler-orbits-97048
## License[MIT](LICENSE)