Position x is returning NaN

Hi, the following code is returning NaN. Why is this? Is this the best way (position[0])to get the x position of an entity?

 var position = instance.getLocalPosition();
 lastButtonPosition= position[0]+myButtonBG.width;


No. A pc.Vec3 doesn’t have array access. Use .x Vec3 | PlayCanvas API Reference

Okay Thanks. I was just going from the manual here: Entity | PlayCanvas API Reference

1 Like

Ugh. Thanks for pointing that out.

Once upon a time, it used to be an array but was removed for performance reasons

Edit: PR made: Updated docs from array format of node.position to vec3 by yaustar · Pull Request #3332 · playcanvas/engine · GitHub