I am using Meteor 0.6.3 with a meteorite. I am trying to develop a game using Three.js which uses Meteor for a multiplayer game. Full code here . I tried using the Atmosphere package here , but I get:
ReferenceError: THREE undefined
My workaround was to include Three.js in the header of my template file. This works when I do not call Three.js functions before starting the client. I ran into a problem when I tried to use a prototype to determine the class of my ally. I had code like:
var Enemy = function() { this.mesh = new THREE.Mesh(); }; var Enemy = function(){}; Enemy.prototype = new Entity();
This gives an error that THREE is not detected, although the code works fine if it is written as:
var Entity = function() { this.mesh = new THREE.Mesh(); }; var Enemy = function() { this.mesh = new THREE.Mesh(); };
I would like to use prototypes like this to manage several types of objects that will have the same basic interfaces. Here are some things I also tried:
Based on the documentation , I tried to place the three.min.js project in project /, project / client /, project / client / compatability / and project / lib /. Every time he either says THREE is undefined, or Meteor crashes.
The definition of these prototypes in the html file, where we call Three.js.
To clarify my question, I am wondering if anyone can suggest how to structure my files so that it loads Three.js and then all my type files, and then try to run the client in Meteor.startup (). Here is the current file structure:
project/model.js project/server/server.js project/client/game.css project/client/game.html project/client/game.js
Please let me know if there is more information that I must provide. Hope I'm not overlooking any keywords!
source share