I have a collection that generates a mesh. The collection has one game object with the mesh, the script and a factory. The factory points to a game object outside of any collection. that game object has a script (
function init(self)
print(go.get_world_position())
end
), collisionobject (static) and sprite. the sprite appears in the editor when I am viewing the .go file.
my main collection has this script
function init(self)
msg.post(“.”, “acquire_input_focus”)
self.control_points = { {0, 0}, {1, 0}, {1, 1}, {0, 1} }
regenerate_mesh(self)
factory.create(“#control_point_factory”, vmath.vector3(400,400,1))
end
this is my init function - regenerate_mesh works fine and generates my mesh which I can view. I cannot however view the control_point which control_point_factory points toward (the game object with sprite and collision object. I can see in the debug output that it’s being created as I see the DEBUG:SCRIPT: vmath.vector3(400, 400, 1) from the init function of the control_point script.
I’ve tried setting the z-index to 0 incase I need a camera (which I don’t currently have) to render z vertices > 0. the z vertex of the mesh object is 0. I added a
function on_input(self, action_id, action)
print(action.x)
print(action.y)
end
to my main script so I can scroll over to a space not occupied by the mesh and try setting the coordinates there - that’s where the 400, 400 comes from, that should be completely free space.
I’m probably doing something stupid but it’s driving me insane, can anyone help?
EDIT: weirdly enough if I put a new game object in my main collection and put my factory in that instead then add a new spawner.script
function init(self)
factory.create(“#control_point_factory”, vmath.vector3(400,400,0))
end
then it works. despite the coordinates being the exact same?? I’ll use this as a workaround for now,