aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJaro Camphuijsen <jjecamphuijsen@gmail.com>2015-11-03 12:58:57 +0100
committerJaro Camphuijsen <jjecamphuijsen@gmail.com>2015-11-03 13:05:49 +0100
commit3817a7b9ca2db88284457d89880171c2fea03ddc (patch)
tree529f47addefb81047fb34ee802e5776059a1233c
parentff6ca6bb7e7cc577c635c5157aba3ad727462c07 (diff)
improve random bodies
-rw-r--r--main.js3
-rw-r--r--style.css4
-rw-r--r--systems.js18
3 files changed, 15 insertions, 10 deletions
diff --git a/main.js b/main.js
index 0d0a063..7efd9aa 100644
--- a/main.js
+++ b/main.js
@@ -121,6 +121,7 @@ function showSubmenu(submenuList, menuButton) {
let menuSvg = menuDiv.selectAll(".menuSvg");
var buttons = menuSvg.selectAll(".subButton")
.data(choreoSubmenuList);
+
buttons.enter()
.append("g")
.attr("class", "button subButton")
@@ -242,7 +243,7 @@ function init() {
let material = new THREE.MeshPhongMaterial();
material.map = b.getTexture();
material.bumpMap = b.getBumpMap();
- material.bumpScale = 0.3;
+ material.bumpScale = 0.2;
material.specularMap = b.getSpecularMap();
let sphere = new THREE.Mesh(geometry, material);
sphere.position.set(b.r.x, b.r.y, b.r.z);
diff --git a/style.css b/style.css
index 102fd15..bdd9676 100644
--- a/style.css
+++ b/style.css
@@ -21,7 +21,7 @@ html, body {
opacity:1;
position: fixed;
top:20px;
- right: 30px;
+ right: 100px;
display: block;
z-index: 5;
color: white;
@@ -53,5 +53,5 @@ text{
}
#stats{
right: 0;
- z-index: -5;
+ z-index: 15;
}
diff --git a/systems.js b/systems.js
index ef71820..ded2648 100644
--- a/systems.js
+++ b/systems.js
@@ -157,7 +157,8 @@ export function genSolarSystem(sunOn) {
let bodies = [sun, mercury, venus, earth, moon, mars, jupiter, saturn, uranus, neptune, pluto];
- let scaleRadius = rad => Math.pow(rad, 1/5);
+ let scaleRadius = rad => Math.pow(rad, 1/4)* 2 *1E-1;
+
for (let b of bodies) {
b.rad = scaleRadius(b.rad);
}
@@ -187,7 +188,7 @@ export function gen2Bodies(sunOn) {
return {
bodies: bodies,
- stepsize: 0.000003,
+ stepsize: 0.004,
stepsPerFrame: 100,
camera: {x: 0, y: 0, z: 250},
collisions: false,
@@ -198,7 +199,7 @@ export function gen2Bodies(sunOn) {
}
export function gen3Bodies(sunOn) {
- let s1 = new Body(1E19, new Vec3(0, 0, 0), new Vec3(0, 2, 0), 12, "sun", new Vec3(0, 0, randomRot()));
+ let s1 = new Body(1E19, new Vec3(0, 0, 0), new Vec3(0, 0, 0), 12, "sun", new Vec3(0, 0, randomRot()));
let s2 = new Body(1E18, new Vec3(200, 0, 0), new Vec3(0, 900, 0), 8, "venus", new Vec3(0, 0, randomRot()));
let s3 = new Body(1E18, new Vec3(-200, 0, 0), new Vec3(0, -900, 0), 8, "earth", new Vec3(0, 0, randomRot()));
let bodies = [s1, s2, s3];
@@ -224,8 +225,10 @@ export function genBodies(n, bodyTexture, sunOn, collisions) {
let posVec = new Vec3(getRandomInt(-300,300), getRandomInt(-300,300), getRandomInt(-300,300));
let velVec = new Vec3(getRandomInt(-500,500), getRandomInt(-500,500), getRandomInt(-500,500));
let rotation = new Vec3(0, randomRot(), 0);
+ let radius = (Math.random() * (15)) + 4;
+
- bodies.push(new Body(1E16, posVec, velVec, 8, getRandomFromList(textureSets.solar), rotation));
+ bodies.push(new Body((radius^3)*1E15, posVec, velVec, radius, getRandomFromList(textureSets.solar), rotation));
}
return {
@@ -235,7 +238,7 @@ export function genBodies(n, bodyTexture, sunOn, collisions) {
camera: {x: 0, y: 0, z: 400},
collisions: collisions,
sunOn: sunOn,
- sphereP: 12,
+ sphereP: 32,
boundary: 2000
};
}
@@ -252,8 +255,9 @@ export function genBodiesRot(n, bodyTexture, sunOn, collisions) {
let posVec = new Vec3(getRandomInt(-300,300), getRandomInt(-300,300), getRandomInt(-300,300));
let velVec = new Vec3(0,0,0);
let rotation = new Vec3(0, randomRot(), 0);
+ let size = (Math.random() * (15)) + 4
velVec.crossVectors(posVec, angMomVec).multiplyScalar(Math.random() + .1);
- bodies.push(new Body(1E14, posVec, velVec, 8, getRandomFromList(textureSet), rotation));
+ bodies.push(new Body(size*1E14, posVec, velVec, size, getRandomFromList(textureSet), rotation));
}
return {
@@ -263,7 +267,7 @@ export function genBodiesRot(n, bodyTexture, sunOn, collisions) {
camera: {x: 0, y: 0, z: 400},
collisions: collisions,
sunOn: sunOn,
- sphereP: 12,
+ sphereP: 32,
boundary: 2000
};
}