Это видео недоступно.
Сожалеем об этом.
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...
Sorry about the bad quality from my mic. Hope you enjoy this video.
Stevie ROF not bad at all
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
How to select 4 wheels
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.
Will do a video on that, just like you see for a very very short time in the beginning of the video :)
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
@@stevie_rofwort it for mobile?
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 :)
OMG im so happy now its the what i searched tutorial
Great to hear!!
Oh my god, thanks so much. I was looking for something just like this. i really appreciate it
Thanks! Enjoy
@@stevie_rof Can you post the source code? I sprained my thumb 20 minutes ago.
I almost died at the Mathf joke @ 39:16 :D
Hahahaha ;)
Thank you so much for your content. As mentioned before, would be great if you add some A.I cars.
Please send a full scripts, I'm working 4h on that and trying to rewrite them and I still have errors.
Thank you so much!!
also make tutorial on lap time, saving best time and fuel. please please please.
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?
Thanks for the good work. Very helpful.
you are better then any other game developer dude.. head off
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
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
how to play a playlist music? I have a script but it plays 2 songs at mismo time
@@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
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.
Please continue this!
did you get it working ?
very good video ........ vewry very good video .... i learned a lot ... thanks from my heart
Please send of course (continue tutorial add car model to program )
Thanks.
really nice dude :)
please continue the video series :(
could you please post the finished game because need it
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?
The script doesn't work. There are now compiler issues. Any suggestions?
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
What program did you use to design the track, Im struggling trying to figure out how to get there
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.
this project (sprites etc) free for commercial use???
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
Skidmarks arent working :C
Seems like the targetPosition for the camera cannot be calculated, as it throws an error for me. Not good!
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?
Richard Mana hi; no Drek was programmed with unity’s WheelColliders.
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?
Dragon Fury3 hi! Can you post the part which isnt working for you?
@@stevie_rof Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
The "ScreenPointToRay" is underlined redl
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
need rally! good car physics engine!
If you want to use the arrow keys for the controller, how would you go about doing that?
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
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 !
Tag Camera as main camera
God thank you for pasting there the script
Great tutorial! How can I make the car go faster when using wheel colliders?
Roberto Ortis hi! With WheelColliders you should use .AddTorque
@@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?
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.
@@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.
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)
Hi great tutorial its hot !!!
Please tutorial Racing position race positioning system T-T
hey im having trouble with "get
{
return _sideSlipAmout;
}
}"
it keeps telling me in the console that ";" is expected
public float SideSlipAmount
{
get
{
return _sideSlipAmount;
}
}
Work on Android?
bruh....
sir will you upload the multiplayer tutorial?
+reynald cruz no sorry.
Stevie ROF :(
done scripts and what you said for skidmarks but nothing is showing?
now same for tire smoke when i start it nothing happens ?? help please
hi . how to make this game for mobile?
Can you help me for audio source pitch settings?
In an upcoming video the audio pitch is covered. Stay tuned :)
@@stevie_rof Waiting Impatiently..
Ahmet Çağrı YORULMAZ uploading!
@@stevie_rof you are best...
26:25
ScreenpointToRay is not working properly and has a red line under it.
Isak captial P?
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);
}
}
}
Isak hm, seems ok. You are getting methods from Camera.main
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?
Actually dont worry i made a new unity project and restarted unity and it fixed the error. Thanks so much for the help!
do u want to sell this game?
Eliran EOS DApp Atidium io
Hi, yes I might
Stevie ROF how can i contact you?
Eliran EOS DApp Atidium io stevierof@gmail.com