I want to be able to set the location of an object that is not the owner of the script from a python script.
So if object a is executing a script, i want the script to move object b
My problem is i can’t get the name of the object i want to move right. I want to be able to use a variable as the name of the object.
for example
X = “OBSUN”
X.setPosition([1,2,3])
What do i need to replace OBSUN with to make it work.
Store the name of the object you want in a variable obj_name
Retrieve the object you want from the list of objects objList[object_name]
Set the object’s world position to the value of your choice. I’m not sure if my example will work with passing a list, but it might. In 2.5x you can also set the world position to a mathutils.Vector which enables easier manipulation of the position.
It was confusing to me for a while. The way I see it now (and I may be mistaken) is that Blender and BGE are two different programs that communicate very well together, although the communication is only one way, from Blender to the game engine.
I believe Blender’s api is optimised for power and control because of the diverse nature of the program while BGE’s api is optimised for speed due to the realtime nature of games.
You are right.
When the BGE starts it converts all the Blender data to BGE data. The Blender data is still present and (if used in Blender) accessable and editable, but it has no effect on the converted BGE data. That’s why some users complain that the changes they did’t are active after the BGE ended. If you create a standalone with the Blenderplayer the Blender part is not available (at least until with 2.49). This might change with 2.5x.