So my player is stuck in idle, he won’t switch to either Walk or Run. Another problem that I have is when i don’t move my players feet are in the ground when I make an movement his feet are on the floor. But the main problem is that he won’t switch between animation. I have is setup that if I press W = Walk, Shift+W = Run the keys adjust the speed but don’t start a new animation.
My PlayerMovement Script:
using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
float speed = 8.0f;
Vector3 direction = Vector3.zero;
CharacterController cc;
// Use this for initialization
void Start () {
cc = GetComponent ();
}
// Update is called once per frame
void Update () {
direction = transform.rotation * new Vector3 (Input.GetAxis (“Horizontal”), 0, Input.GetAxis (“Vertical”)).normalized;
if (Input.GetKey (KeyCode.LeftShift)) {
speed = 8.0f;
I don’t get any errors just it won’t switch from Idle to either Walk or Run. I have been stuck with this for about 3 days trying to fix this.
(I can’t add the script as an Attachment in this post I have tried but it won’t work I’m sorry for this)
So I addet the GetCompnent() already I figured that out. I set the parameters up in the Mecanim system. Now I need to do 1 thing and that is add that to the code but how I tried looking it up but no luck.
My Code now (I can’t add code tags in reply sorry)
using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
public class PlayerController : MonoBehaviour
{
public class PlayerMovement : MonoBehaviour {
float speed = 8.0f;
Vector3 direction = Vector3.zero;
CharacterController cc;
// Use this for initialization
void Start () {
cc = GetComponent ();
GetComponent ();
}
// Update is called once per frame
void Update () {
direction = transform.rotation * new Vector3 (Input.GetAxis (“Horizontal”), 0, Input.GetAxis (“Vertical”)).normalized;
if (Input.GetKey (KeyCode.LeftShift)) {
speed = 8.0f;