Third Person Movement Help

Okay, so I’ve been working on my third person movement set up for my game, and I’m trying to go with a set up similar to just cause 2. So ive got a set up which limits the rotation up and down, and allows my mouse movement to rotate the player, but what i would like is for the player only to rotate via mouse control when a key is being pressed, in this case w. and id like my camera to rotate left and right when the player is not moving. If that makes sense. I tried setting up my logic like this


but its not working, you can rotate the player even when youre not pressing w. I believe this is because python controllers are actually ors, but i could be wrong. Anyway, if you guys know how to fix this, that would be great. here is my current attempt.

As you noticed, Python controllers will execute as long as just one of their sensors is triggered. If you need to check additional conditions, you can do so easily at the beginning of your script. For example if you wanted to implement the AND controller functionality, you could put something like this at the start of your script.

cont = bge.logic.getCurrentController()
for sens in cont.sensors:
    if not sens.positive:
        break
else:
    # include the rest of your code indented here

In Just Cause 2 , the mouse is orbiting the camera around the player and as soon as you press W the player is switching from the idle animation to the running animation , first it rotates and then it starts to move in the direction where the camera is pointing while the camera is following him. Are you trying to do something like that ? No blend file ? The link you posted has no blend file , only upload options. JC2 setup behaves almost like , the camera is parented to the player while the player is parented to the camera. Use python to create the copy location constraint. Don’t use direct parenting.

Attachments

JC2 Player 001.blend (535 KB)

if sens1.positive and sens2.positive:
(tab)Do stuff

Interesting. Sorry about the bad link, here http://www.pasteall.org/blend/28097

awesome, got it working! thanks guys! Also blueprint, sorry for the low donation, i dont have my paycheck yet, but when i do ill be able to contribute more to wrectified! (:

Thanks for donating!

No worries! Least I can do with how much you help me haha, and plus wrectified is awesome, I really think it will give blender the boost it needs for people to start seeing the game engine as useful alternative to others.