I understand how to get variables from other scripts, and I’m doing that quite a lot in my current project. What I’m wondering is, is there a way to name the variables from other scripts as something else in the first script? For example I have:
Manager.attributes.add('rotConst', {type: 'entity', title: 'Rotation Constraint'});
Manager.prototype.initialize = function()
{
if(this.rotConst.script.p2RevoluteConstraint.motorEnabled)
{
this.rotConst.script.p2RevoluteConstraint.motorEnabled = false;
}
};
Manager.prototype.start = function()
{
this.rotConst.script.p2RevoluteConstraint.motorEnabled = true;
this.rotConst.script.p2RevoluteConstraint.motorSpeed = 2;
};
Manager.prototype.update = function(dt)
{
if(this.rotConst.script.p2RevoluteConstraint.motorEnabled && this.accel)
{
this.rotConst.script.p2RevoluteConstraint.motorSpeed += 0.025;
}
//Logic here to stop acceleration after speed reaches given value
};
Is there a way I can name the motorEnabled and motorSpeed variables in this script so I don’t have to constantly use this.rotConst.etc. Let’s say I name motorEnabled as isOn and motorSpeed as just speed so I can access their values quicker.