I want to get updated pos because I want next push into array of positions
but I’m getting the same initial position in this.arrPos I mean it pushing the same position
addPos(){
if(this.app.keyboard.wasPressed(pc.KEY_P)){
this.arrPos.push(this.entity.position);
console.log('pos added');
}
}
// update code called every frame
update(dt) {
this.addPos();
}
pc.Entity#position is not API. Did you mean to do:
var pos = this.entity.getPosition();
Note that if you want to store off that position and reference/access it later, you should clone it. Otherwise, its value will change every time the entity moves. So: