owner.localPosition and owner.localPosition not working?

OK i have a object i need to move to a certain position specified in a Global Variable. I’ve tried using own.localPosition = [x,y,z] though it seems not to be owrking at all in this instance. The object spawned using the addObject Actuator then assigned a variable. Using this variable it finds it’s location index in a list. Using this index it finds it’s position. Now it does all that just find, it just won’t move to the position nor orient itself for that matter.

the list it retrieves is behind the # sign

Here is the code:


import bge

# client data = [clientnum,['name',[x,y,z],orientation,action]]


cont = bge.logic.getCurrentController()
own = cont.owner

entitylist = bge.logic.entitylist

clientnumber = own['entity number']

number = bge.logic.entitynumberlist.index(clientnumber)

print('entity', clientnumber, 'Position: ', entitylist[number][1][1])
own.localPosition = entitylist[number][1][1]
own.localOrientation = entitylist[number][1][2]

like i said before it does find the required information it needs. I just need help on why own.localPosition and own.localOrientation isn’t working. Oh and BTW i used both these in a separate blend file and it works fine, just not in this instance for some reason.

Have you tried using worldPosition instead? Local is based on the object’s axis, while world is based on the world axis.

Yes, yes I have.:frowning:

Maybe you should print own as well. Maybe it is not the object instance you expect?
If you can’t use the name (because it is not unique) you might want to print the id instead id(own).

Thanks for the reply monster. Though right before you replied it worked again. Oddly enough I just changed the objects physics property from no collision to static then back again and it worked. I have no idea why but im glad this problem is over.