Hello again! The this.entity.enabled function is not working and when its supposed to enable in the script using a variable, it won’t enable. I’m sure the variable part is right because I used console.error to let me know the variable is working. Thank you!
var Walk = pc.createScript('walk');
var move2 = 1;
// initialize code called once per entity
Walk.prototype.initialize = function() {
};
// update code called every frame
Walk.prototype.update = function(dt) {
if (move2 === 0) {
this.entity.enabled = true;
this.entity.translateLocal(0, -0.10, 0)
}
if (move2 === 1) {
this.entity.enabled = false;
}
};