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() {
|
GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
if (this.chassis && this.chassis.instance) {
|
||||||
var instance = new CANNON.RaycastVehicle({
|
var instance = new CANNON.RaycastVehicle({
|
||||||
chassisBody: this.chassis.instance
|
chassisBody: this.chassis.instance
|
||||||
});
|
});
|
||||||
|
|
||||||
//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);
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue