code review fixes

This commit is contained in:
Philip Rosedale 2017-04-25 22:14:03 -07:00
parent 663e682f23
commit c69d064cc3
4 changed files with 33 additions and 35 deletions

View file

@ -34,7 +34,7 @@ var sword1 = Entities.addEntity({
grabbable:true grabbable:true
} }
}) })
}) });
var sword2 = Entities.addEntity({ var sword2 = Entities.addEntity({
type: "Box", type: "Box",
@ -50,7 +50,7 @@ var sword2 = Entities.addEntity({
grabbable:true grabbable:true
} }
}) })
}) });
Script.scriptEnding.connect(function scriptEnding() { Script.scriptEnding.connect(function scriptEnding() {
Entities.deleteEntity(sword1); Entities.deleteEntity(sword1);

View file

@ -31,8 +31,7 @@
angularTimeScale: timescale, angularTimeScale: timescale,
ttl: ACTION_TTL ttl: ACTION_TTL
}; };
var success = Entities.updateAction(_this.copy, _this.actionID, props); Entities.updateAction(_this.copy, _this.actionID, props);
return;
} }
function createSpringAction(timescale) { function createSpringAction(timescale) {
@ -46,7 +45,6 @@
ttl: ACTION_TTL ttl: ACTION_TTL
}; };
_this.actionID = Entities.addAction("spring", _this.copy, props); _this.actionID = Entities.addAction("spring", _this.copy, props);
return;
} }
function createCopy() { function createCopy() {
@ -69,7 +67,7 @@
grabbable:false grabbable:false
} }
}) })
} };
_this.copy = Entities.addEntity(props); _this.copy = Entities.addEntity(props);
} }

View file

@ -111,7 +111,6 @@
ttl: ACTION_TTL ttl: ACTION_TTL
}; };
var success = Entities.updateAction(_this.copy, _this.actionID, props); var success = Entities.updateAction(_this.copy, _this.actionID, props);
return;
} }
function createSpringAction(timescale) { function createSpringAction(timescale) {
@ -148,7 +147,7 @@
grabbable:false grabbable:false
} }
}) })
} };
_this.copy = Entities.addEntity(props); _this.copy = Entities.addEntity(props);
} }

View file

@ -51,7 +51,8 @@ Script.update.connect(function(dt) {
var dv = { x: 0, y: 0, z: 0}; var dv = { x: 0, y: 0, z: 0};
for (var j = 0; j < n; j++) { for (var j = 0; j < n; j++) {
if (i != j) { if (i != j) {
dv = Vec3.sum(dv, Vec3.multiply(G * dt / Vec3.distance(props[i].position, props[j].position), Vec3.normalize(Vec3.subtract(props[j].position, props[i].position)))); dv = Vec3.sum(dv, Vec3.multiply(G * dt / Vec3.distance(props[i].position, props[j].position),
Vec3.normalize(Vec3.subtract(props[j].position, props[i].position))));
} }
} }
Entities.editEntity(bodies[i], { velocity: Vec3.sum(props[i].velocity, dv)}); Entities.editEntity(bodies[i], { velocity: Vec3.sum(props[i].velocity, dv)});