Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Voilà le code que j'ai utilisé sur la version 2020

using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class move : MonoBehaviour

{

    public float speed = 6f;


    public float Jumpspeed = 8f;


    public float gravity = 20f;


    private Vector3 moveD = Vector3.zero;

    CharacterController Cac;


    void Start()

    {

        Cac = GetComponent<CharacterController>();

    }


    void Update()

    {

        if (Cac.isGrounded)

        {

            moveD = new Vector3(0, 0, Input.GetAxis("Vertical"));

            moveD = transform.TransformDirection(moveD);

            moveD *= speed;


         if (Input.GetButton("Jump"))

            {

                moveD.y = Jumpspeed;

            } 

        }

        moveD.y -= gravity * Time.deltaTime;

        transform.Rotate(Vector3.up * Input.GetAxis("Horizontal") * Time.deltaTime * speed * 10);


        Cac.Move(moveD * Time.deltaTime);

    }

}

Bon déjà, j'ai copié collé le script, pour moi le script marche en tout cas.