I am trying to make the sensors and actuators work in the script with scene objects but they only work with the main object, how can i make them work with scene objects on the script?

  • $\begingroup$ Please include information about the objects, your logic editor and scripts that you are using in whatever are you doing. $\endgroup$ Nov 14, 2017 at 0:45
  • $\begingroup$ Just for info: There is no "main" object. Python code gets executed by the "current controller". A controller is owned by an object (often referred as owner). A controller is connected to several sensors and actuators. Each sensor and each actuator is owned by an object (not necessarily the same object as the owner of the others). This is fixed as you can't change that while the game is running. But what the sensors detect is not fixed. This is recalculated at each single frame and can be read from the sensor e.g. via hitObjectLists(). $\endgroup$
    – Monster
    Nov 14, 2017 at 7:01

1 Answer 1


Logic bricks are attached to a single object. You can use message actuators and sensors to get an object to respond to another objects sensor.

Using a python controller it is possible to access other objects in the scene.

# Loop through all other objects in the scene
sce = bge.logic.getCurrentScene()
print("Scene Objects:", sce.name)
for ob in sce.objects:
    print("   ", ob.name, ob.worldPosition)
  • $\begingroup$ Sorry for the late response, thx you so much for this :) $\endgroup$
    – Yasef
    Nov 16, 2017 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .