Это видео недоступно.
Сожалеем об этом.

Unity3D - Top Down Racing game Tutorial

Поделиться
HTML-код
  • Опубликовано: 24 июн 2018
  • In this tutorial we are building a top down racing game. Without any wheel colliders we create top-down racing game where you can drift around corners on a custom track.
    Please like and subscribe if you like my video's!
    UnitySkidmarks: github.com/Nit...

Комментарии • 98

  • @stevie_rof
    @stevie_rof  6 лет назад +31

    Sorry about the bad quality from my mic. Hope you enjoy this video.

    • @magist7077
      @magist7077 6 лет назад +3

      Stevie ROF not bad at all

    • @hugo5467
      @hugo5467 6 лет назад +1

      Stevie ROF Can you do a tutorial on maybe a score system or that grass makes you slower or maybe even multiplayer? Btw ur channel is awesome

    • @yashwanth2620
      @yashwanth2620 5 лет назад

      How to select 4 wheels

  • @dominiauk
    @dominiauk 6 лет назад +3

    Really great video. Are you expecting to continue this as a series of tutorials? I'd be interested on seeing you adding drag for different surfaces (eg. grass when come off the track) and AI cars. Really hope you continue this series and thanks for all the work on this.

    • @stevie_rof
      @stevie_rof  6 лет назад

      Will do a video on that, just like you see for a very very short time in the beginning of the video :)

    • @dominiauk
      @dominiauk 6 лет назад

      Is there a way of adding the concept of grip for different vehicles? I've been playing with the rigidbody but can't see how I can increase grip. Thanks

    • @rakencs.
      @rakencs. 7 месяцев назад

      ​@@stevie_rofwort it for mobile?

  • @ConcreteJungleGames
    @ConcreteJungleGames 3 года назад

    Look like a really fun mechanic, I hope your game goes well. Thank you for the tutorial, I'll be using it in my Uni assignment :)

  • @satch___
    @satch___ 4 года назад +1

    OMG im so happy now its the what i searched tutorial

  • @frazylazy3449
    @frazylazy3449 3 года назад

    Oh my god, thanks so much. I was looking for something just like this. i really appreciate it

    • @stevie_rof
      @stevie_rof  3 года назад

      Thanks! Enjoy

    • @frazylazy3449
      @frazylazy3449 3 года назад

      @@stevie_rof Can you post the source code? I sprained my thumb 20 minutes ago.

  • @robosergTV
    @robosergTV 3 года назад +1

    I almost died at the Mathf joke @ 39:16 :D

  • @paulocampello369
    @paulocampello369 Год назад

    Thank you so much for your content. As mentioned before, would be great if you add some A.I cars.

  • @slendiv13
    @slendiv13 4 года назад +7

    Please send a full scripts, I'm working 4h on that and trying to rewrite them and I still have errors.

  • @hardgamer6919
    @hardgamer6919 Год назад +1

    Thank you so much!!

  • @acclogin8464
    @acclogin8464 6 лет назад +7

    also make tutorial on lap time, saving best time and fuel. please please please.

  • @GiuseppeTonello
    @GiuseppeTonello 4 года назад +2

    I've tried a lot of things to make the skidmarks work but nothing is showing. One thing that I notice is that the shader is giving me a warning in the inspector: Material property is found in another cbuffer than "UnityPerMaterial" (_MainTex_ST). I don't know if it's that or something else. Note that the Skidmark gameobject is not a child of the Car object and is set to 0,0,0. Any tip on how to solve that?

  • @richardmana4007
    @richardmana4007 6 лет назад +1

    Thanks for the good work. Very helpful.

  • @samikhan2144
    @samikhan2144 6 лет назад +1

    you are better then any other game developer dude.. head off

  • @leight9503
    @leight9503 5 лет назад

    Just a little comment from my personal experience:
    Do not use Time.DeltaTime or any simmular default functions. If you have a piece of code that should work with physics or movement use your own delta time calculations from last frame update calls for every script. ( - )
    A reason for that is you dont have control on when exacly your particular update call will happen. Time.DeltaTime just tells you how long it took to process last frame, but you need a time passed since update call in your particular script that happened last frame.
    You have lots of other systems running inside updates or fixed updates in your project and you never know how long it will take to reach your particular code ( you dont know how unity will manage your gameobjects and in which order they will be processed). Time.DeltaTime approach only works of we assume that the only thing happened during last frame is our script we working with.
    So, in the end you will face a lot of strange jittery movements and other problems(like your car with constant speed will pass same distance faster or slower from time to time) all over the place, once your project will become big enough. You will never notice this on small scenes , but it will hurt you when actual testing will happen

    • @stevie_rof
      @stevie_rof  5 лет назад +1

      Hi! I have yet to come across the problems you describe. The only problem i have had is when using fixedupdate with non-physics movement. All other jitter movement problems are solved by keeping all movements in the same update.
      But again, I haven’t experienced this in my projects (including several finished and complete projects) beside the normal jittery.
      In this video things aren’t as they supposed to be, as in my nearly finished project the movement is done quite differently to achieve the same effect.
      The problems are noticeable when adding multiplayer functionality. But my approach is always to keep things small and simple as you work out your basic gameplay programming.
      Nevertheless, thanks for your comment hopefully your comment can help someone out in the future.
      Stevie

    • @LuciaRodriguez-kq4pw
      @LuciaRodriguez-kq4pw 4 года назад

      how to play a playlist music? I have a script but it plays 2 songs at mismo time

    • @filipposecchi942
      @filipposecchi942 4 года назад

      @@LuciaRodriguez-kq4pw instantiate it in your c# script using random function and set your musics in the controller, this should work, if you want to choose songs then you need some UI to give inputs

  • @needmorebrain
    @needmorebrain 4 года назад

    very cool video. Where do you get the math from? Are there any easy tutorials which explain quarternions and such? I do not have any idea what these are about.

  • @Akshaytg
    @Akshaytg 5 лет назад +2

    Please continue this!

  • @sharifnewazchowdhury700
    @sharifnewazchowdhury700 5 лет назад

    very good video ........ vewry very good video .... i learned a lot ... thanks from my heart

  • @ozzozozo
    @ozzozozo 5 лет назад +3

    Please send of course (continue tutorial add car model to program )

  • @mehmetakifyetkin3755
    @mehmetakifyetkin3755 3 года назад +1

    Thanks.

  • @HawkHuman
    @HawkHuman 6 лет назад +2

    really nice dude :)

  • @robosergTV
    @robosergTV 4 года назад

    please continue the video series :(

  • @rymm9347
    @rymm9347 2 года назад

    could you please post the finished game because need it

  • @isaacwildflower214
    @isaacwildflower214 5 лет назад

    I'm a complete beginner at Unity, haven't done anything in it, and I'm using this tutorial as a starting point, is there a way to make it so W key is throttle, A and D keys are turning, and S is brake?

  • @danharnden6389
    @danharnden6389 5 лет назад +1

    The script doesn't work. There are now compiler issues. Any suggestions?

    • @gamingwithegoon
      @gamingwithegoon 5 лет назад

      I had the same problem, look all the way at the bottum of your unity screen you will probably see some kind of error . for me it was a asset i had imported that dident rly work

  • @saucedupfilms
    @saucedupfilms 5 лет назад +1

    What program did you use to design the track, Im struggling trying to figure out how to get there

    • @stevie_rof
      @stevie_rof  5 лет назад

      Tay Le'Ville hi! The track is made using Blender. Its opensource an free to use. At around 40:00 minute in the video this process is demonstrated.

  • @dapurtutorial9822
    @dapurtutorial9822 6 лет назад

    this project (sprites etc) free for commercial use???

    • @stevie_rof
      @stevie_rof  6 лет назад

      Wahyu Kurniawan hi, the assets that I am showing in the beginning of the video is not included in the tutorial.
      If I remember correctly, the car is from a free asset pack

  • @Pyro_Ether
    @Pyro_Ether 2 года назад +1

    Skidmarks arent working :C

  • @kovacsbence5521
    @kovacsbence5521 4 года назад

    Seems like the targetPosition for the camera cannot be calculated, as it throws an error for me. Not good!

  • @richardmana4007
    @richardmana4007 6 лет назад

    Ah what I also wanted to ask: Did you program your car game Drek in a similar way, so that you just use the third person perspective instead of the top-down in the engine?

    • @stevie_rof
      @stevie_rof  6 лет назад

      Richard Mana hi; no Drek was programmed with unity’s WheelColliders.

  • @dragonfury3378
    @dragonfury3378 5 лет назад +1

    Hi, I am very new to create a racing game as one of my first projects. I was following the tutorial, but I was having problems while writing the first part of the code. I kept getting an error with the ScreenPointToRay. Could someone pls help me?

    • @stevie_rof
      @stevie_rof  5 лет назад

      Dragon Fury3 hi! Can you post the part which isnt working for you?

    • @dragonfury3378
      @dragonfury3378 5 лет назад

      @@stevie_rof Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      The "ScreenPointToRay" is underlined redl

  • @richardsatterthwaite4572
    @richardsatterthwaite4572 4 года назад

    i used ur code for the Camera but when i start the game it dose not even work for me. i need Help plz?? all so the scrip has no errors

  • @drrobotnik5376
    @drrobotnik5376 3 года назад

    need rally! good car physics engine!

  • @GTvsForza
    @GTvsForza 3 года назад

    If you want to use the arrow keys for the controller, how would you go about doing that?

    • @stevie_rof
      @stevie_rof  3 года назад

      Hi, one way would be to rotatie vehicle based in some speed * input horizontal around the y axis of the car.
      Perhaps increase the 'some speed' towards a maximum

  • @MartinTalon2006
    @MartinTalon2006 5 лет назад +1

    hi bro! Im new using unity and i have an error, im trying to fix it for 1 hour and i cant. My car dont moves. this is my code using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class PlayerCar : MonoBehaviour
    {
    [SerializeField] float acceleration = 8;
    [SerializeField] float turnSpeed = 5;
    Quaternion targetRotation;
    Rigidbody _rigidBody;
    void Start()
    {
    _rigidBody = GetComponent();
    }
    void Update()
    {
    SetRotationPoint();
    }
    private void SetRotationPoint()
    {
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    Plane plane = new Plane(Vector3.up, Vector3.zero);
    float distance;
    if (plane.Raycast(ray, out distance))
    {
    Vector3 target = ray.GetPoint(distance);
    Vector3 direction = target - transform.position;
    float rotationAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg;
    targetRotation = Quaternion.Euler(0, rotationAngle, 0);
    }
    }
    private void FixedUpdate()
    {
    float accelerationInput = acceleration * (Input.GetMouseButton(0) ? 1 : Input.GetMouseButton(1) ? -1 : 0) * Time.fixedDeltaTime;
    _rigidBody.AddRelativeForce(Vector3.forward * accelerationInput);
    transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, turnSpeed * Time.deltaTime);
    }
    }
    and the camera's code is
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class Cameracontrol : MonoBehaviour
    {
    [SerializeField]Transform observeable;
    [SerializeField] float aheadSpeed;
    [SerializeField] float followingDamping;
    [SerializeField] float cameraHeight;
    Rigidbody _observableRigidBody;
    void Start()
    {
    _observableRigidBody = observeable.GetComponent();
    }
    // Update is called once per frame
    void Update()
    {
    if (observeable == null)
    return;
    Vector3 targetPosition = observeable.position + Vector3.up * cameraHeight + _observableRigidBody.velocity * aheadSpeed;
    transform.position = Vector3.Lerp(transform.position, targetPosition, followingDamping * Time.deltaTime);
    }
    }
    pls help !

    • @tehanperera4
      @tehanperera4 4 года назад

      Tag Camera as main camera

    • @slendiv13
      @slendiv13 4 года назад

      God thank you for pasting there the script

  • @RobertoOrtis
    @RobertoOrtis 4 года назад

    Great tutorial! How can I make the car go faster when using wheel colliders?

    • @stevie_rof
      @stevie_rof  4 года назад

      Roberto Ortis hi! With WheelColliders you should use .AddTorque

    • @RobertoOrtis
      @RobertoOrtis 4 года назад

      @@stevie_rof thanks for the reply, I will try. Currently, I am just applying motorTorque times the user's input. If I increase it, the car goes crazy and out of control. With addTorque won't I have the same effect?

    • @stevie_rof
      @stevie_rof  4 года назад

      Roberto Ortis ah yes! I meant that. You will need to add a rigid body as well, with some sensible values to make it work.

    • @RobertoOrtis
      @RobertoOrtis 4 года назад

      @@stevie_rof I have been playing around with the wheel colliders settings but it's a mess, lol. I want to make it feel more like an arcade style of racing.

    • @stevie_rof
      @stevie_rof  4 года назад +1

      Roberto Ortis I usually remove the colliders that are added from the model/mesh and use a more simple boxcollider. This usually works better with wheelcolliders. Also, add another empty gameobject and set this localPosition as the centerOfMass of the rigidbody. This way you can tweak the position of the CoM a little more easy (forward)

  • @StreeTraceuresvideos
    @StreeTraceuresvideos 5 лет назад

    Hi great tutorial its hot !!!

  • @amedjuzwyhruiz4827
    @amedjuzwyhruiz4827 5 лет назад

    Please tutorial Racing position race positioning system T-T

  • @k0shmarNevaBroke
    @k0shmarNevaBroke 4 года назад

    hey im having trouble with "get
    {
    return _sideSlipAmout;
    }
    }"
    it keeps telling me in the console that ";" is expected

    • @hcpuefiuhfdue1996
      @hcpuefiuhfdue1996 4 года назад

      public float SideSlipAmount
      {
      get
      {
      return _sideSlipAmount;
      }
      }

  • @bigsmoke8344
    @bigsmoke8344 5 лет назад +2

    Work on Android?

    • @TOx1CC
      @TOx1CC 4 года назад

      bruh....

  • @reynaldcruz2309
    @reynaldcruz2309 6 лет назад

    sir will you upload the multiplayer tutorial?

  • @brapppstar2314
    @brapppstar2314 5 лет назад

    done scripts and what you said for skidmarks but nothing is showing?

    • @brapppstar2314
      @brapppstar2314 5 лет назад

      now same for tire smoke when i start it nothing happens ?? help please

  • @unitytutorials4802
    @unitytutorials4802 4 года назад

    hi . how to make this game for mobile?

  • @AhmetoSanchez
    @AhmetoSanchez 5 лет назад

    Can you help me for audio source pitch settings?

    • @stevie_rof
      @stevie_rof  5 лет назад +1

      In an upcoming video the audio pitch is covered. Stay tuned :)

    • @AhmetoSanchez
      @AhmetoSanchez 5 лет назад

      @@stevie_rof Waiting Impatiently..

    • @stevie_rof
      @stevie_rof  5 лет назад +1

      Ahmet Çağrı YORULMAZ uploading!

    • @AhmetoSanchez
      @AhmetoSanchez 5 лет назад

      @@stevie_rof you are best...

  • @pangwino
    @pangwino Год назад

    26:25

  • @MegaWombatGaming
    @MegaWombatGaming 6 лет назад

    ScreenpointToRay is not working properly and has a red line under it.

    • @stevie_rof
      @stevie_rof  6 лет назад

      Isak captial P?

    • @MegaWombatGaming
      @MegaWombatGaming 6 лет назад

      This is all my code:
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class PlayerCar : MonoBehaviour {
      [SerializeField] float turnSpeed = 5;
      Quaternion targetRotation;
      void Update()
      {
      SetRotationPoint();
      transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, turnSpeed * Time.deltaTime);
      }
      private void SetRotationPoint()
      {
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); //screen point to ray not working
      Plane plane = new Plane(Vector3.up, Vector3.zero);
      float distance;
      if (plane.Raycast(ray, out distance))
      {
      Vector3 target = ray.GetPoint(distance);
      Vector3 direction = target - transform.position;
      float rotationAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg;
      targetRotation = Quaternion.Euler(0, rotationAngle, 0);
      }
      }
      }

    • @stevie_rof
      @stevie_rof  6 лет назад

      Isak hm, seems ok. You are getting methods from Camera.main

    • @MegaWombatGaming
      @MegaWombatGaming 6 лет назад

      It always gives me this error: Assets/Scripts/test.cs(9,31): error CS1061: Type `object' does not contain a definition for `ScreenPointToRay' and no extension method `ScreenPointToRay' of type `object' could be found. Are you missing an assembly reference?

    • @MegaWombatGaming
      @MegaWombatGaming 6 лет назад

      Actually dont worry i made a new unity project and restarted unity and it fixed the error. Thanks so much for the help!

  • @adoptedbybitcoin
    @adoptedbybitcoin 6 лет назад

    do u want to sell this game?

    • @stevie_rof
      @stevie_rof  6 лет назад +1

      Eliran EOS DApp Atidium io
      Hi, yes I might

    • @adoptedbybitcoin
      @adoptedbybitcoin 6 лет назад

      Stevie ROF how can i contact you?

    • @stevie_rof
      @stevie_rof  6 лет назад

      Eliran EOS DApp Atidium io stevierof@gmail.com