changing the 'track to' object property in an actuator?

I’ve looked at the docs and it states to use

track_to = own.actuators[‘track’].track_object

but this appears to be false…I’ve tried ‘object’ , ‘trackObject’ and 'track_object and all give me errors. what is the correct method?

the correct method:

cont = bge.logic.getCurrentController()
own = cont.owner
track_to = own.actuators[‘trackTo…or whatever string I used’]
track_to.object = some_object

track_to    = cont.actuators['track_to']
track_to.object = objectyoulike

#edit you are using own. does that work? (no idea, normally you need to grab the controller(cont))

so mine works like this:

def tracking(cont):               
    track_to        = cont.actuators['track_to']
    track_to.object = objectyoulike

make sure your track to actuator is connected to your python controller

i am sure he got that part

and all give me errors

#edit anyway what errors do you get? :slight_smile:

own = cont.actuators #has never let me down before.
track_to = own.actuators[‘track’].object #works

and I no longer get the error???
!!Except!! it does not actually track the player, even if I set it in the actuator? I must be doing something wron somewhere…I have ised track object many times and never had this issue…I need to just check and recheck what is going on in my script, maybe it has something to do with my logic…and I am changing it somewhere else…more than likely some silly mistake somewhere.

ok…I was not getting an error, but it was still wrong…
two issues(really simple)
after I defined it as “track_to”

  1. I just needed to reassign the value as “track_to.object = some_object”

it should have been
track_to = own.actuators[‘trackTo…or whatever string I used’]
track_to.object = some_object
as Cotaks stated.

  1. I still need to connect a testing condition to the actuator like “always”…it does not matter if it is connected to the python controller…
    who would have thought.???

I tested it with nothing assigned in the actuator and it still changes ‘targets’…so solved.