I have a script that is attached to player it makes an empty follow to position of the character but when I run the game the empty is always deviating from the objects current position how do I fix that?
This is the script:
import bge
import mathutils
cont = bge.logic.getCurrentController()
soul = cont.owner
def main():
scene = bge.logic.getCurrentScene()
body = scene.objects['Player']
sens = cont.sensors['always']
bodRot = body.worldOrientation.to_euler().z
solRotList = [soul.worldOrientation.to_euler().x, soul.worldOrientation.to_euler().y, bodRot]
solRot = mathutils.Euler(solRotList).to_matrix()
if sens.positive:
soul.worldPosition = body.worldPosition
soul.worldOrientation = solRot
else:
None
main()
...
It works, but 'soul' takes time to follow the body (hence the 'delay' or 'lag'). The script is attached to an always sensor with True level triggering. I believe the lag is due to less frequency per frame of the script. How do I increase it?