Faster way to track to with physics?

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…

Tell me what you think?

is there a faster way?

Attachments

PhysicsTurretVcone (1).blend (521 KB)

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?

My setup will allow for the object to be interacted with physically, and maintain 6dof joint limiting,

Actually, I wouldn’t mind a peek, if that’s ok. I’ve been having trouble with axis to vect lately and would love to see a functional example.

Hmm i would just let a script handle the tracking.

This is what i use and so far it works great:
TrackToClosest.blend (662 KB)

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)

Or do i understand it wrong?

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

OFCOURSE! Yes, now I see. I’ve been using alignVectTo -> worldPosition. Thank you so much, honestly this is just the best.

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.

to simulate a cannon can be better getVectTo(target)[2] that return a simple vector normalized
+x = right
-x = left

  • applyRotation()