When jumping, is teleporting up and slowlly come's backdown

Hello, i have this problem, when i try to jump, first the player goes(or teleports) to fast up, then he came back down normally…how to make it jump normally?

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour
{
    //auto
    //private Animator anim;
    private CharacterController controller;
    public float speed = 600.0f;
    private Vector3 moveDirection = Vector3.zero;

    //gravity
    public float gravity = 20.0f;

    //jump continuously
    public float jumpForce = 30f;

    void Start()
    {
        controller = GetComponent<CharacterController>();
        //anim = gameObject.GetComponentInChildren<Animator>();
    }

    void Update()
    {
        //if (Input.GetKey("w"))
        //{
        //    anim.SetInteger("AnimationPar", 1);
        //}
        //else
        //{
        //    anim.SetInteger("AnimationPar", 0);
        //}

        if (controller.isGrounded)
        {
            moveDirection = transform.right * Input.GetAxis("Horizontal") * speed;
        }

      
        transform.Rotate(0, moveDirection.z * speed * Time.deltaTime, 0);
        controller.Move(moveDirection * Time.deltaTime);
        moveDirection.y -= gravity * Time.deltaTime;

        if (Input.GetKeyDown("space"))
        {
            transform.Translate(Vector3.up * jumpForce * Time.deltaTime, Space.World);
        }
    }
}

Hi and welcome!

That’s what you implemented. You basically tell the program that you want the transform to go up by some amount when you press space. The rest is handled by gravity. So yes, your jump is a teleport. If you do not want that, then you need to make the character slowly go up over multiple frames.
There are a ton of good tutorial series on character controls. I can recommend you the one by Sebastian Lague:

It probably makes sense to start at episode 7, where he starts implementing the character controller. The above is the episode where he implements jumping tho. To get a rough idea, jumping starts at 5m41s. The idea is to keep track of the velocities and add those every frame. Those velocities can then be altered by things like gravity, jumping and so on.
You are already doing something similar with moveDirection, however you need to not reset it but add or subtract from it. Again, the tutorial series explains this in way more detail.

Hope this helps :slight_smile:

thanks for help mate!