Skip to content

Commit

Permalink
fixed physics!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren committed May 26, 2016
1 parent 79ccf50 commit cb3593b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 35 deletions.
25 changes: 7 additions & 18 deletions dist/starsandcrafts-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -56825,6 +56825,7 @@ module.exports = SC.Interface = Class.extend({
});

},{"peerjs":6,"three":18}],22:[function(require,module,exports){
(function (global){
StarsAndCrafts = SC = {};
module.exports = SC;

Expand All @@ -56833,7 +56834,7 @@ var Class = require('resig-class'),
THREE = require('three');

// inject Three.js
var Physijs = require('physijs-browserify')(THREE);
global.Physijs = require('physijs-browserify')(THREE);

Physijs.scripts.worker = '../../node_modules/physijs-browserify/libs/physi-worker.js';
Physijs.scripts.ammo = 'ammo.js';
Expand Down Expand Up @@ -56928,6 +56929,7 @@ SC.Server = Class.extend({

});

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./StarsAndCrafts.Cosmos.js":19,"./StarsAndCrafts.Events.js":20,"./StarsAndCrafts.Interface.js":21,"./Util.js":23,"./things/StarsAndCrafts.Asteroid.js":25,"./things/StarsAndCrafts.Comet.js":26,"./things/StarsAndCrafts.Model.js":27,"./things/StarsAndCrafts.Star.js":28,"./things/StarsAndCrafts.Thing.js":29,"./things/StarsAndCrafts.Torpedo.js":30,"jquery":1,"physijs-browserify":14,"resig-class":15,"three":18,"three-fly-controls":16}],23:[function(require,module,exports){
module.exports = {

Expand Down Expand Up @@ -57481,13 +57483,6 @@ THREE.GPUParticleContainer.prototype.constructor = THREE.GPUParticleContainer;
},{"three":18}],25:[function(require,module,exports){
var THREE = require('three');

// inject Three.js
var Physijs = require('physijs-browserify')(THREE);

Physijs.scripts.worker = '../../node_modules/physijs-browserify/libs/physi-worker.js';
Physijs.scripts.ammo = 'ammo.js';


module.exports = StarsAndCrafts.Thing.extend({

// for now, Objects are just mesh.
Expand Down Expand Up @@ -57549,7 +57544,7 @@ module.exports = StarsAndCrafts.Thing.extend({

});

},{"physijs-browserify":14,"three":18}],26:[function(require,module,exports){
},{"three":18}],26:[function(require,module,exports){
var THREE = require('three');
THREE.GPUParticleSystem = require('./../lib/GPUParticleSystem.js');

Expand Down Expand Up @@ -57632,9 +57627,6 @@ module.exports = StarsAndCrafts.Thing.extend({
var THREE = require('three');
THREE.STLLoader = require('three-stl-loader')(THREE);

// inject Three.js
var Physijs = require('physijs-browserify')(THREE);

module.exports = StarsAndCrafts.Model = Class.extend({


Expand Down Expand Up @@ -57689,7 +57681,7 @@ module.exports = StarsAndCrafts.Model = Class.extend({

});

},{"physijs-browserify":14,"three":18,"three-stl-loader":17}],28:[function(require,module,exports){
},{"three":18,"three-stl-loader":17}],28:[function(require,module,exports){
var THREE = require('three');

module.exports = Class.extend({
Expand Down Expand Up @@ -57806,9 +57798,6 @@ module.exports = Class.extend({
var THREE = require('three'),
Class = require('resig-class');

// inject Three.js
var Physijs = require('physijs-browserify')(THREE);

module.exports = StarsAndCrafts.Thing.extend({

init: function(_server, options) {
Expand All @@ -57828,7 +57817,7 @@ module.exports = StarsAndCrafts.Thing.extend({

_server.transparentMaterial = _server.transparentMaterial || new THREE.MeshLambertMaterial({
color: 0xaaaa00,
opacity: .5,
opacity: 0,
transparent: true
});
_server.transparentMaterial.depthWrite = false;
Expand Down Expand Up @@ -57916,4 +57905,4 @@ module.exports = StarsAndCrafts.Thing.extend({

});

},{"physijs-browserify":14,"resig-class":15,"three":18}]},{},[22]);
},{"resig-class":15,"three":18}]},{},[22]);
14 changes: 12 additions & 2 deletions server/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,22 @@

var server = new StarsAndCrafts.Server();

torpedo = new SC.Torpedo(server);

SC.Scenarios['asteroids'](server);

torpedo = new SC.Torpedo(server);

SC.Scenarios['eros'](server);

setInterval(function() {

torpedo.mesh.setLinearVelocity({
x: Math.sin(server.clock.elapsedTime / 3),
y: Math.cos(server.clock.elapsedTime / 3),
z: 0
});

},50);

</script>

</body>
Expand Down
2 changes: 1 addition & 1 deletion src/StarsAndCrafts.Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var Class = require('resig-class'),
THREE = require('three');

// inject Three.js
var Physijs = require('physijs-browserify')(THREE);
global.Physijs = require('physijs-browserify')(THREE);

Physijs.scripts.worker = '../../node_modules/physijs-browserify/libs/physi-worker.js';
Physijs.scripts.ammo = 'ammo.js';
Expand Down
7 changes: 0 additions & 7 deletions src/things/StarsAndCrafts.Asteroid.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
var THREE = require('three');

// inject Three.js
var Physijs = require('physijs-browserify')(THREE);

Physijs.scripts.worker = '../../node_modules/physijs-browserify/libs/physi-worker.js';
Physijs.scripts.ammo = 'ammo.js';


module.exports = StarsAndCrafts.Thing.extend({

// for now, Objects are just mesh.
Expand Down
3 changes: 0 additions & 3 deletions src/things/StarsAndCrafts.Model.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
var THREE = require('three');
THREE.STLLoader = require('three-stl-loader')(THREE);

// inject Three.js
var Physijs = require('physijs-browserify')(THREE);

module.exports = StarsAndCrafts.Model = Class.extend({


Expand Down
5 changes: 1 addition & 4 deletions src/things/StarsAndCrafts.Torpedo.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
var THREE = require('three'),
Class = require('resig-class');

// inject Three.js
var Physijs = require('physijs-browserify')(THREE);

module.exports = StarsAndCrafts.Thing.extend({

init: function(_server, options) {
Expand All @@ -23,7 +20,7 @@ module.exports = StarsAndCrafts.Thing.extend({

_server.transparentMaterial = _server.transparentMaterial || new THREE.MeshLambertMaterial({
color: 0xaaaa00,
opacity: .5,
opacity: 0,
transparent: true
});
_server.transparentMaterial.depthWrite = false;
Expand Down

0 comments on commit cb3593b

Please sign in to comment.