Printing position

I’ve created a variable

UiStats.attributes.add('spawn', { type: 'entity' , title:'SpawnPoint'});

and printing its position on start

UiStats.prototype.initialize = function() {
        console.log( +" " + this.spawn.position);

although I elevated the object to [0,0.5,0] and it’s located under an object that is at [0,0,0]
this.spawn.position generates [0,0,0]
and only this.spawn.localPosition gives the desired [0,0.5,0]

what position stands for? why was it returning empty vector?

position isn’t part of the public API. It’s an internal temporary property. (It should really be named _position to clearly mark it as internal).

You need to do:

UiStats.prototype.initialize = function() {
    var position = this.spawn.getPosition();
    console.log( + " " + position.toString());

(See the API reference manual for pc.Entity#getPosition).

so what you say is - if i don’t wanna use locaposition, i rather use getPosition() than just position?

You shouldn’t use either localPosition or position properties. They are not part of the API.

You should use:

pc.Entity#getLocalPosition // get position relative (local) to parent
pc.Entity#getPosition      // get world-space position