Unlike the local pos from go.get_position()
, the position reported by go.get_world_position()
doesn’t update if the object’s position is changed.
Running the following:
local startp = go.get_position()
local wp1 = go.get_world_position()
local lp1 = vmath.vector3(startp)
lp1.x = lp1.x + 100
go.set_position(lp1)
local lp2 = go.get_position()
local wp2 = go.get_world_position()
print('\n', startp, wp1, '\n', lp2, wp2)
…gives you:
DEBUG:SCRIPT:
vmath.vector3(0, 0, 0) vmath.vector3(0, 0, 0)
vmath.vector3(100, 0, 0) vmath.vector3(0, 0, 0)
(The second world pos hasn’t updated.)