In the following code
initialize()
{
this.vec_initTargetPos11 = new pc.Vec3(-2, 0, -2);
this.vec_targetPos11 = this.vec_initTargetPos11;
}
update()
{
this. this.vec_targetPos11.x++;
console.log("vec_initTargetPos11 = " + this.vec_initTargetPos11);
}
this.vec_initTargetPos11
variable is getting updated, even though it is not assigned to this.vec_targetPos11
anywhere.
How is this possible?
if I replace
this.vec_targetPos11 = this.vec_initTargetPos11;
with
this.vec_targetPos11 = new pc.Vec3(-2, 0, -2);
then it works fine.
But why it shouldn’t work as it is in script?
Seems very ridiculous.