sen = controller.sensors[“sensor1”]
sen.propName = “prop”
val = sen.value
print val
act = controller.actuators[“act”]
act.object = val
act.use3D = True
This script was supposed to make the obj track another object, tha name of whic was the same of the propertyvalue. BUt, as you can guess, it isn’t functioning
controller = GameLogic.getCurrentController()
sen = controller.sensors[“sensor”]
if sen.positive :
val = sen.value
if ‘OB’ in val : val=val[2:]
act = controller.actuators[“Track”]
act.object = val
Yet another way of doing it. I left it so it still uses the message actuators to set the object being tracked.
I changed the first property actuator to assign “OBAAA” to the property named Tracker instead of “AAA”. That is just for testing purposes to make sure the code strips “OB” from in front of the Object name if it’s there.
Also, the Track To uses the Y axis so I rotated the pointer axis so the tip points along the y axis instead of the z. And I set the Track To to use 3D.