How to set position only in one axis?

How to set position only in Y, dont want to use translate, this code not working

this.setCarPos(entity, this.entity.position.y);
...

    setCarPos(entity, y){
            entity.position.y = y;
    }

this.entity is trigger pos,
entity is car pos

Hi @grzesiekmq,

Get the current position first and then use that to fill the other values.

var pos = entity.getPosition();
entity.setPosition(pos.x, y, pos.z);
2 Likes