mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:37:48 +02:00
code review fixes
This commit is contained in:
parent
663e682f23
commit
c69d064cc3
4 changed files with 33 additions and 35 deletions
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)});
|
||||||
|
|
Loading…
Reference in a new issue