I have different objects in a scene and I want to control them with python code. My question is? Do I have to create a script for every object or I can control all of them with only one python script? I've tried with only one script but then there is only one object as the controller... and I need to change the properties of an object that is not the "controller". I don't know if I explained this well.
You can access all objects from the scene by its name:
import GameLogic scene = GameLogic.getCurrentScene() obj=scene.objects['ObjectName']
To access the vertices:
import GameLogic scene = GameLogic.getCurrentScene() obj=scene.objects['Cube'] mesh = obj.meshes for v in range(mesh.getVertexArrayLength(0)): vert = mesh.getVertex(0, v) print( "%d,%d,%d" % ( vert.x, vert.y, vert.z )) print( dir( vert ))