I’ve posted this question before, but I haven’t had time to tinker with it until recently and I’m still experiencing Blender brain freeze.
I’m trying to modify Social’s FPS Template for third person. What I’m having trouble with is getting the player to turn in the right direction on the x and y axis when movement keys are pressed. By the “right direction” I mean if a movement key is pressed, say the “forward” key, the character will turn to face away from the camera (which is controlled by the mouse). For the “left” key the character will turn to face to the left side of the camera frame, etc. How far a character needs to rotate when he begins moving is based on three things: the character’s current orientation, the orientation of the camera, and which directional key is pressed (left, right, back, forward).
I was able to find a solution using getOrientation and setOrientation but it results in instant rotation. I need a method (probably using an IPO?) that will cause “slow” rotation. Does anyone have any suggestions?
You can download the file so far without any character rotation here.
WASD to move.
Move mouse to control camera.
Also, as a side question, you’ll notice in the download that the character animation often get screwed up and “sticks” on the first frame of the run animation rather than playing the “rest” animation when the character is not in motion. Can someone inspect my code and tell me why this is happening?
Thanks for your help.