Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to add jumping to brackeys 3rd person movement tutorial

Does anyone know how to add jumping to brackeys 3rd person movement tutorial

Best Answer

  • SoulBlazeSoulBlaze Member
    edited June 11 Accepted Answer

    ~

    using UnityEngine;

    class JumpThePlayer : MonoBehaviour

    {

    [SerializeField] private float JumpHeight = 15f; //Serialize field is used so that you can edit this private variable in inspector

    [SerializeField] private float JumpSpeed = 2f;

    CharacterController controller;

    void Start()

    {

    controller = GetComponent<CharacterController>();

    }

    void Update()

    {

    Jump();

    }

    void Jump()

    {

    controller.Move(0f, JumpHeight * JumpSpeed * Time.deltaTime, 0f);

    }

    }

    ~

Sign In or Register to comment.