Factory.create doesn't immediately set the position of the object

Hey!
Ran into a weird issue.

[code]local v = vmath.vector3(1,2,3)
local objs = {}
objs[1] = factory.create(factory_url, nil, nil, {spawn_pos = v})
objs[2] = factory.create(factory_url, nil, nil, {spawn_pos = v})

for i=1, #objs do
local pos = go.get_world_position(objs[i])
print( "Object at " … pos.x … “,” … pos.y … “,” … pos.z )
end[/code]

This will return the vectors (0,0,0) if I run this code. But if I run the position print code later, it’ll print the correct position.

Where do you run this code (update(), init(), on_message()?) and where did you put the position print that gave the spawn position?

Ran all the code as-is in a function called from on_message. The print was right after factory.create, just like in the code above

The code that eventually did print the correct position was just for testing, which I just slapped into the move function for the player, printing it every time I moved

Ok, if I recall correctly, objects transforms happen after update() (and maybe after on_message()) for each component type. I guess the position is not set until after transform.

I have a similar issue. When I enable a sprite it will “spawn” at its last position for one frame and then jump to the right position.
The sprite is located on a gameobject which is in the right position when the sprite gets enabled.