delayed instance creation
parent
c5bb684272
commit
7055891a84
|
@ -66,16 +66,19 @@ GameLib.D3.RaycastVehicle.prototype.constructor = GameLib.D3.RaycastVehicle;
|
|||
*/
|
||||
GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
||||
|
||||
var instance = new CANNON.RaycastVehicle({
|
||||
chassisBody: this.chassis.instance
|
||||
});
|
||||
/**
|
||||
* At this point - even though this component exists - the chassis could maybe not been have assigned, failed to
|
||||
* register as a dependency, and therefore is not present at the time of createInstance() - we will need to call
|
||||
* delayedInstance somehow...
|
||||
* @type {GameLib.D3.RaycastVehicle|GameLib.D3.API.RaycastVehicle|*}
|
||||
*/
|
||||
var instance = false;
|
||||
|
||||
//TODO: maybe move this into linking system - ALSO - store a reference to the wheel somehow to update the wheel instance?
|
||||
this.wheels.map(
|
||||
function(wheel){
|
||||
instance.addWheel(wheel.instance);
|
||||
}
|
||||
);
|
||||
if (this.chassis && this.chassis.instance) {
|
||||
var instance = new CANNON.RaycastVehicle({
|
||||
chassisBody: this.chassis.instance
|
||||
});
|
||||
}
|
||||
|
||||
return instance;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue