Now I can just use that to set the actuator to off, and rotate it to that location,
here is what I have so far,
import bge
cont = bge.logic.getCurrentController()
own = cont.owner
own['StartLoc']=str(own.localOrientation)
## this is ran once on each trackto object
should I have
always - python -
import bge
from bge import render
cont = bge.logic.getCurrentController()
own = cont.owner
actu = cont.actuators['TrackIt']
if own['target']!=None:
actu.object = own['target']
cont.activate(actu)
try:
actu.object = own['target']
except ValueError:
cont.deactivate(actu)
own.LocalRotation=own['StoreLocal']
here is my current setup
I am not sure why it fails, and if I deactivate a trackTo and change it’s target to “None” it still tries to track the “dead” object…
maybe I will have to have the object spawn something that it can track back to?
You had no else statements in the scripts only if and if and if , lol , check this one. Try to cleanup the code , cause it’s killing the cpu. If you check the performance , the logic part jumps at 20%. For a single robot scene the logic should be at 2% or less.
The logic execution was only spiking because he had an unhandled exception in a script that was run every frame, flooding the console with error messages. Other than that there are no performance issues with the code itself.
Alright, so now, I need 1 empty spawned 1 time, for each track to item, that automagically parents to the “torso” (I think?)
so when the track to is finished, each item begins tracking it’s empty, and then shuts of the actuator, and when the limb is removed, the empty is ended.
Sounds good. You can use empty.setParent(target,true,true) and empty.removeParent() but you could also do empty.worldPosition = target.worldPosition to stick the empty onto the target.