Sensor Logic Brick: owner

owner
  • Returns the game object that owns the logic brick.

Type: 
  • KX_GameObject
Sample Code


################  get the game object that owns the logic brick  
 
# import bge module

import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the sensor attached to the controller
# my sensor is named Sensor_1

sen = cont.sensors["Sensor_1"]

# get game object that owns sensor
obj = sen.owner