Logic brick Idea ->TorqueTrackTo

I posted a long time ago that I need help with this,


Object 1 always attempts to line up “Target axis” (a vector that is changeable) to nearest target property, or a target object
using Torque or ANG-V

I want this first in python,

then later maybe a logic brick

I am not skilled enough to do it, but know that it will help everyone…

This could become a dropdown context of edit object ->“track to”

Target object or nearest target property
max torque +x,+y,+z
and max torque -x.-y,-z

So this could aim Rag doll heads, and hands etc,


do you know theres something called “python controller”?
with this little thingy you can do anything you want without requesting useless logic bricks(seriusly why this would be useful for anyone else than you?)
originally made by pqftgs

v = own.getVectTo(own['target'])[2]        
if v[2] > 0.0:
    own.applyRotation([0.015, 0.0, 0.0], True)
    own.applyRotation([-0.015, 0.0, 0.0], True)
if v[0] > 0.0:
    own.applyRotation([0.0, 0.0, -0.015], True)
    own.applyRotation([0.0, 0.0, 0.015], True)[

Check this out luc,

here is a rag doll with IK targets for his hands,

he is 100% physical motions,

so if I can have “Torque track to” in his head, and to control his “Hip target”

then I can give the BGE a “physical IK doll” that attempts to mimic a IK bone rig…

in other words easily animated rag dolls, that can be “interfered” with in motion

like blocking for instance, or shooting your leg out from under you…

So in other words, it opens up possibilities for all
and C is faster is it not?

and python and logic are both valid,
logic bricks are more specialized and can run faster…


PhysicalMoveTo.blend (558 KB)

and with the code you just pasted

now he has a “head Ik target”


PhysicalMoveTo.blend (566 KB)

Now I will make a “Rigid Ik Ragdoll” and contribute it to all,

want to help?

(sorry about double post I am excited)

im glad it worked, even when i don`t understand anything of what you wrote, anyway, just go and give thanks to pqftgs, he is the original maker of the script i posted

want to help?

not really, i dont even have time for my own projects, i wont help you sorry

Did you check the .blend?

it has potential to animate in game rag doll actions

An alternative code could be:

targetName = 'Target'
fac = 0.05

def followTarget(cont):
    own = cont.owner
    if 'tar' not in own:
        own['tar'] = own.scene.objects[targetName]
    tar = own['tar']
    dir = own.getVectTo(tar)[1]
    own.alignAxisToVect(dir, 1, fac)

I need it to be physical

IE torque or angleV

Why don’t you replace ‘applyRotation’ with ‘applyTorque’?

I don’t see what’s wrong with the regular TrackTo logic brick. It already has a time option, so you can have smooth tracking.

TrackTo based on torque would not work so well, because it would overshoot the target, swing back, overshoot it again, and so on. The only way to make it work would be with some fancy polynomial math, which is over my head.

Yes, you’re right.

It has to be, or it will negate its physics…
the object is a rigid body,
slapping it would make it twist,
is the idea, and then it applies torque to line back up…