This turret setup is pretty fast for checking a vision cone every frame etc, as it contains no python, etc.
I think that you could use some vector math, etc. with orientations to track to a target with torque,
but I am not sure what kind of sensor would work better for this…
I have a small prototype turret setup with AlignAxisToVect, it works great and is really fast. It locks on to whatever enemy is closest to it, no gigantic logic hassle, and no huge cone sensor. I don’t know how optimized it is, probably not very, but i was able to do it with a pretty small script. Do you want me to post it or are you just looking for ideas?
And if you have faster moving object with yours it doesn’t track so well, it dont hit anything anymore.
yours with the same delay brick and faster speed. PhysicsTurretVcone (test).blend (588 KB)
Ok, hold left click to aim the turret (which is just a cube in this blend) and let go for it to aim at the nearest enemy. It’s verrry much a prototype and it doesn’t shoot, but the aiming is there and it should help you out with AlignAxisToVect if that’s what your’e struggling with!
Blend: https://www.dropbox.com/s/oqg81sape6drlpj/Turret.blend
The problem with track to target, or align to vector, is that it’s instant, you can overcome this by aiming at a invisible object that moves at the target, while the turret casts a ray, but this uses more resources, and you can’t smack it around physically, like shooting the gun will cause it to move.