GameLib.D3.ComponentRaycastVehicleControls = function( componentId ) { this.componentId = componentId || GameLib.D3.Tools.RandomId(); this.parentEntity = null; // Todo: this should be executed somewhere in game-lib-z, so that we don't execute it on every construction of an object. GameLib.D3.Utils.Extend(GameLib.D3.ComponentRaycastVehicleControls, GameLib.D3.ComponentInterface); }; ///////////////////////// Methods to override ////////////////////////// GameLib.D3.ComponentRaycastVehicleControls.prototype.onUpdate = function( deltaTime, parentEntity ) { this.parentEntity.mesh.material.color = new THREE.Color(Math.random(), Math.random(), Math.random()); }; GameLib.D3.ComponentRaycastVehicleControls.prototype.onRegistered = function( parentScene ) { // Hook in document.eventlisteners // save values & in the update method we just apply them on the vehicle itself };