Been scratching my head for days. Here’s my script
public class characterMovement : MonoBehaviour {
public float speed = 6.0f;
public float gravity = -75.0f;
public float jumpSpeed = 100.0f;
private Vector3 moveDirection = Vector3.zero;
void Start ()
{
}
void Update()
{
CharacterController controller = GetComponent<CharacterController>();
moveDirection = new Vector3(0, 0, Input.GetAxis("Horizontal"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
//checking if grounded
if (controller.isGrounded)
{
print("grounded!");
if (Input.GetKeyDown(KeyCode.Joystick1Button0))
{
moveDirection.y = jumpSpeed;
print("we jumpin");
}
}
//move the thing
moveDirection.y = gravity;
controller.Move(moveDirection * Time.deltaTime);
}
}
When I play the game and hit the “A” button on the 360 controller, I get my “we jumpin” message, which tells me its receiving the input, but I still can’t get the character to jump. My public floats are the same in the script as they are in the unity editor.