- Home /
Alan Wake style 3rd person character controls, help!
Hey, Im doing a 3rd person horror game as my degree work and now im trying to get my characters animations to work with the controls. This video i captured will give a idea of the controls im going to have in the game:
Example video of my characters controls
Controls in a nutshell:
- Character can't face the camera, camera always rotates with the player. 
- mouse can move freely, character rotates when going far enough in x axis. 
- I have fps input controller. Because i want sideways movement in keyboard to be strafing not rotating. 
So my questions are:
- What kinda code should i use to apply my animations to walk, strafe(left,right), and walk backwards? 
- What kind of code should i use to apply animation to the character when she starts to rotate around herself (mouse looking)? 
Answer by animatefi · Nov 22, 2011 at 08:29 PM
I found out the solution to the first question already, the script goes like this:
function Update () {
animation.wrapMode = WrapMode.Loop;
if (Input.GetAxis("Horizontal") > 0)
{ animation.CrossFade("straferight");
 }
 else if(Input.GetAxis("Horizontal") < 0)
 {
     animation.CrossFade("strafeleft");
 }
    if (Input.GetAxis("Vertical") > 0)
 {
     animation.CrossFade("walk");
 }
 else if(Input.GetAxis("Vertical") < 0)
 {
     animation.CrossFade("backwalk");
 }
 else
 {
     if (Input.GetAxis("Horizontal") == 0)
         {
         animation.CrossFade("idle");
         }
 }
 }
Your answer
 
 
             Follow this Question
Related Questions
On Collision with water buoyancy and play Swim animation 1 Answer
Simple Character Animations 2 Answers
Character To Player tutorial - Animations not working 1 Answer
Character Aiming 1 Answer
Input Script And Mecanim 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                