aframe-nbody-system
v1.0.0
Published
An N-Body system for A-Frame.
Downloads
3
Maintainers
Readme
aframe-nbody-component
A n-body system for A-Frame. Depends on aframe-physics-system
Use this system if you want to do a simulation of celestial bodies. Only use it if you really feel like tweaking a lot of values. This n-body system only does a direct gravitational n-body simulation. Does not take relativity into consideration. There are no calculation optimizations. Barnes–Hut simulation coming in the future.
Stars sky image from: http://www.chrusion.com/public_files/tycho/Stars_Tycho2_3000.png
API
| Property | Description | Default Value | | -------- | ----------- | ------------- | | g | Gravitational constant of the universe | |
Installation
Note you have to turn off gravity from the aframe-physics-system for this to work.
Browser
Install and use by directly including the browser files:
<head>
<title>My A-Frame Scene</title>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-nbody-system/dist/aframe-nbody-system.min.js"></script>
</head>
<body>
<a-scene physics="gravity: 0" nbody="g: 9">
<a-entity nbody material="color: #0000ff" geometry="primitive: sphere; radius: 1.0;" dynamic-body="shape: sphere; sphereRadius: 1.0; mass: 1.0" position="5 -14 -35"></a-entity>
<a-entity nbody material="color: #00ff00" geometry="primitive: sphere; radius: 1.2;" dynamic-body="shape: sphere; sphereRadius: 1.2; mass: 1.2" position="-4 15 -55"></a-entity>
</a-scene>
</body>
npm
Install via npm:
npm install aframe-nbody-system
Then require and use.
require('aframe');
require('aframe-nbody-system');