Using navmesh as controller and making character jump ( unable to jump as of now)

Hello,

I try to make a game with pandemonium like controls, character should move around in a 3d enviroment in a path, while used controls left right and jump options. with another script i set the path with navmesh. However character just doesnt jump, jump line works since it gives jump to console however, the character doesnt jump at all.

Here is my code thanks for advice

using UnityEngine;
using System.Collections;

public class Jump : MonoBehaviour {
	public bool grounded = true;
	public float jumpPower = 1;
	// Use this for initialization

	IEnumerator SetGroundedTrue(){
		yield return new WaitForSeconds (1);

		grounded=true;


	}

	void Start () {

	}

	// Update is called once per frame
	void FixedUpdate () {
		//if (Physics.Raycast (transform.position, Vector3.down, transform.localScale.y / 2) || Physics.Raycast (transform.position - new Vector3 (transform.localScale.x / 2, 0, 0), Vector3.down, transform.localScale.y / 2) || Physics.Raycast (transform.position + new Vector3 (transform.localScale.x / 2, 0, 0), Vector3.down, transform.localScale.y / 2)) {
		//	grounded = false;
		//}

		if (Input.GetButtonDown("Jump") && grounded == true) {
			transform.Translate(Vector3.up * jumpPower * Time.deltaTime);
			grounded = false;
			Debug.Log("Jump");
			StartCoroutine ("SetGroundedTrue");
		}
	}


}

NavmeshAgent controls movement of an object in every dimension, so it just overrides your attempts to move an object in vertical direction. It moves exactly along the navmesh itself. Try to make player’s model a child of a NavmeshAgent and move it up and down when jumping using transform.localPosition.

Translate needs to be continuously called in update.

You are only calling it for 1 frame when your GetKeyDown is true. Take the logic out of the input controls and it should work.

        if (Input.GetButtonDown("Jump") && grounded)
        {            
            grounded = false;
            Debug.Log("Jump");
            StartCoroutine("SetGroundedTrue");
        }

        if (!grounded)
        {
            transform.Translate(Vector3.up * jumpPower * Time.deltaTime);
        }

In my approach I wanted absolute control over movement as I intend to use root bone animation for movement, also there will be knockbacks, etc to handle.

First I set updatePosition and updateRotation on the agent both to false.

Next on update I use :

Agent.nextPosition = Controller.transform.position;

This updates the simulated position of the agent so that it will update the position on the path, etc.
Finally I move the character controller towards the Agent.steeringTarget which is the Vec3 of the next node of the path to move towards.