I want to change this script that I wrote that allow’s my player to jump so I can use a Rigidbody on my player. The reason why I am change it is because when the player collides with a Rigidbody he get’s push I want the player to get push not the enemy (Rigidbody) I don’t know if a CC can get push.
public float jumpSpeed = 0.7f;
public float gravity = 2;
CharacterController controller;
Vector3 currentMovement;
// Use this for initialization
void Start ()
{
controller = GetComponent<CharacterController>();
}
// Update is called once per frame
void Update ()
{
if (!controller.isGrounded)
currentMovement -= new Vector3 (0, gravity * Time.deltaTime, 0);
else
currentMovement.y = -9.81f;
if (controller.isGrounded && Input.GetButtonDown("Jump"))
currentMovement.y = jumpSpeed;
controller.Move (currentMovement);
}
}