Problem with collectionfactory.create (SOLVED)


#1

I’m implementing a collectionfactory to create npcs on my map. I’m developing some test code as such:
Creating the npc:

props[hash("/npc_1")] = { at_tile = vmath.vector3(12, 2, 0) }
cx, cy = coords_to_screen(12, 2)
pos = vmath.vector3(cx, cy, 0)
self.npcs = collectionfactory.create("#npcfactory", pos, nil, props)

and in the npc script, i have at_tile defined:
go.property(“at_tile”, vmath.vector3(0,0,0))

The GO appears correctly on the screen, however at_tile is always 0,0,0 Am I doing something wrong with the properties?


#2

I should have been using a regular factory rather than a collection factory.


#3

You can pass properties to game objects when creating via a collection factory.