Guias

2.5D Platformer in Unity – (E03): Jump (Double Jump) & Gravity








In this third episode, we will be able to make a simple jump and a double jump as well.

● Project files on GitHub:
● Playlist:

♥ Subscribe:
——————————————————————–

MY BEST GAMES:
● Rotator 3D:
● Helix Jump 3D:
● Runner Wheel 3D:
——————————————————————–

FOLLOW ME:
● Facebook:
● Twitter:
● Sketchfab:
● Website:
——————————————————————–

► All content by GDTitans is 100% free. I believe that education should be freely available to everyone.

Link do Vídeo






18 Comentários

  1. when i jump into a ceiling my character stays there for as long as the jump lasts and the gravity is instant when i fall off a platform
    edit:fixed these on my own, heres the code (no double jump)

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;

    public class movement : MonoBehaviour

    {

    public CharacterController controller;

    private Vector3 direction;

    public float hspeed=8;

    public float jumpforce=10;

    public float Gravity = -20;

    public Transform GroundCheck;

    public LayerMask GroundLayer;

    public Transform CeilingCheck;

    void Update()

    {

    float hInput= Input.GetAxis("Horizontal");

    direction.z = hInput * hspeed;

    bool isCeiling = Physics.CheckSphere(CeilingCheck.position,0.15f,GroundLayer);

    bool isGrounded = Physics.CheckSphere(GroundCheck.position,0.2f,GroundLayer);

    direction.y += Gravity * Time.deltaTime;

    if (isGrounded)

    {

    if (Input.GetButtonDown("Jump"))

    {

    direction.y = jumpforce;

    }

    }

    if (isCeiling)

    {

    direction.y=Gravity/2;

    }

    controller.Move(direction * Time.deltaTime);

    }

    }

  2. Help,
    i do as the script said, but found that my character stuck and can`t do a jump
    do all the changes but still hasn`t got any progress 🙁

  3. You sir, are a genius, thank you so much for this tutorial, it helped me very much!
    Have a great day!

  4. when i move Gravity * Time.deltaTime to else condition, my player can only jump once after that jump key become disable.. what happen?

  5. Very nice and simple tutorial sir. I would suggest that you explain a bit about some of the components we are using in unity.

  6. Is direction.y = -1; really necessary? When I put that in my code as you've showed, I have to press the jump button twice or more to jump.

  7. hello I want to ask why when I make a public transfrom in my unity there is an error like this error CS0246: The type or namespace name 'Transfrom' could not be found

    I don't know how to handle it

  8. I am a complete beginner in unity
    your endless runner series has helped me a lot
    As I am a beginner i cant add the score and highscore functionality in the game
    Please make a video on this topic please
    Thank you so much for your videos

Comentários estão fechados.