Functionality to set and get X, Y or Z position component of a node

Very often I find myself wanting to set only the X, Y, or Z component of a node’s position. It’s cumbersome to have to first call get_position, then set the component of the returned vector3, and finally call set_position.

If I could do something like gui.set_position_x(node, gui.get_position_x(node) + 52) it would clean up my code a bit.

You could do gui.set_position(node, gui.get_position(node) + vmath.vector3(52, 0, 0)) although that would create a very short-lived vector3 so it depends on how often you need to do it.

1 Like