Skip to content
jbaicoianu edited this page Apr 7, 2013 · 1 revision

All Things in the game inherit from elation.engine.things.generic. This class defines all of the functionality other Things need to interact with the world and other objects in the scene.

    this.defineProperties({
      'position':       { type: 'vector3', default: [0, 0, 0], comment: 'Object position, relative to parent' },
      'orientation':    { type: 'quaternion', default: [0, 0, 0, 1], comment: 'Object orientation, relative to parent' },
      'scale':          { type: 'vector3', default: [1, 1, 1], comment: 'Object scale, relative to parent' },
      'velocity':       { type: 'vector3', default: [0, 0, 0], comment: 'Object velocity (m/s)' },
      'angular':        { type: 'vector3', default: [0, 0, 0], comment: 'Object angular velocity (radians/sec)' },
      'mass':           { type: 'float', default: 0.0, comment: 'Object mass (kg)' },
      'render.mesh':    { type: 'string', comment: 'URL for JSON model file' },
      'render.scene':   { type: 'string', comment: 'URL for JSON scene file' },
      'render.collada': { type: 'string', comment: 'URL for Collada scene file' }
    });
    this.defineActions({
      'spawn': this.spawn,
      'move': this.move
    });
    this.defineEvents({
      'thing_create': [],
      'thing_add': ['parent'],
      'thing_remove': [],
      'thing_destroy': [],
      'thing_tick': ['delta'],
      'thing_think': ['delta'],
      'thing_move': [],
      'mouseover': ['clientX', 'clientY', 'position'],
      'mouseout': [],
      'mousedown': [],
      'mouseup': [],
      'click': []
    });
Clone this wiki locally