Turning Animations in BGE

I’ve been doing some optimizations and additions to my game, to make it more appealing. One aspect I focused on today was standing and movement. I also realized that I’m missing one thing: turning while standing.

I’m sure you guys have played third person games? You know when you stand and you turn, the player moves it’s legs when it turns? How can I accomplish this?

Also, note that I’m using Python for this. Since I found it a better alternative than logic bricks.

try this method:

Attachments

Turning Animations.blend (776 KB)

you make the animation for the player turning at a set rate (linear interpolation) without the origin keys changing x or y position only z
then at the end delete the root rotation offset

(so the angent acts like he is trying to turn while standing in place)

in game play animation + rotate hitbox object which is parent of no collision armature object

Thanks for the method, but I’m considering something.

Is there a way to detect mouse movement on a specific axis? I’ve been searching all over the docs and couldn’t conclude something.

check the mouse input gathering system

prop x and y in the mouse controller

So I would add two game properties: X and Y. Then I would define the orientations of the torso and legs?

How would I, therefore, detect the motion that way? I do understand what method you’re going to, but I’m just wanting to clarify.

did you tried laifa Attached File or no?

x = offset of x axis

if abs(x)>.01:
    if x>0:
        x-=.01
        own.applyRotation([0,0,rate],1)
        own.children['armaturename'].playAction(args)
    else:
        x+=.01
        own.applyRotation([0,0,-rate],1)
        own.children['armaturename'].playAction(args)
else:
      x=0

Yes, I tried it.