Found some odd behaviour in Playcanvas 1.51.7
Finally managed to track down what’s going wrong in my game
This code that used to work fine, about a week ago, and (of course) I haven’t made any changes to it.
I’ve provided a simplified code and output example below.
Any thoughts? @yaustar
//----------------------------------------------
// Sample code, would be attached to an entity
//----------------------------------------------
ScoreChase.prototype.initialize = function() {
this.heightIndicator = this.entity;
];
ScoreChase.prototype.show = function() {
let linePos = this.heightIndicator.getLocalPosition().clone();
linePos.y = linePos.y - 2.0;
console.log("(BEFORE) getLocalPosition = ", this.heightIndicator.getLocalPosition());
let self = this;
this.positionTween = this.heightIndicator
.tween(this.heightIndicator.getLocalPosition())
.to({x: linePos.x, y: linePos.y, z: linePos.z}, 0.25, pc.QuadraticInOut)
.on('complete', function () {
console.log("HeightIndicator.prototype.setPosition: self.heightIndicator = ", self.heightIndicator);
console.log("(AFTER) getLocalPosition = ", self.heightIndicator.getLocalPosition());
});
};
//----------------------------------------------
// Console output
//----------------------------------------------
[Log] (BEFORE) getLocalPosition = – t {x: 557, y: -12.5, z: 0, …}
[Log] HeightIndicator.prototype.setPosition: self.heightIndicator = – e {_callbacks: Object, _callbackActive: {}, name: "HeightIndicator", …}
[Log] (AFTER) getLocalPosition = – t {x: NaN, y: NaN, z: NaN, …}