Тёмный

How to: Car Controller Unity + Camera + Github link 

Nanousis Development
Подписаться 1,9 тыс.
Просмотров 59 тыс.
50% 1

Опубликовано:

 

17 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 188   
@lucas.barenchi
@lucas.barenchi 9 месяцев назад
Amazing work! Im working on a car drift game 2 years now, but everytime is good to re-review the code of the car controller because is always something to perform!
@uacser
@uacser 6 месяцев назад
He's prepared a HotWheels to show us the drift's mechanics. Respect!
@vex123
@vex123 Год назад
Great work! I'm completely new to Unity and was able to follow your tutorial pretty well. Other than the webcam blocking the script, job well done. You've earned my subscription. :)
@nanousis
@nanousis Год назад
Thanks mate, I appreciate it 😊
@Heicho_Levi
@Heicho_Levi 4 месяца назад
Thanks man. I am currently a university student in Turkey. I am studying Computer Programming. I had to make a game and it was going to be a car-based game. Luckily I came across your videos. It helped me a lot, thank you again. Greetings from Turkey to everyone.
@Heicho_Levi
@Heicho_Levi 4 месяца назад
I want to stay tuned and check out your other videos. But after my projects and exams are done :)
@jewelthomas7086
@jewelthomas7086 11 месяцев назад
This is one of the best Car Controller tutorials out there. Really Appreciate it. I also wondered how the vehicle damage system worked and how to implement it. +1 subscriber
@hiqqoqotamus
@hiqqoqotamus Год назад
Dude I've been looking for a car controller tutorial for a while now, after finding yours I have been so happy! Thanks for the great tutorial! +1 Subscriber!!
@nanousis
@nanousis Год назад
Glad I managed to help mate 😊😊
@AHEK8
@AHEK8 Год назад
its works you are our next brackeys
@fantabulousclipsfullhd6887
@fantabulousclipsfullhd6887 Год назад
You remind me of brackeys. Keep up the good work. Hope you will get 1 million subscribers soon and keep making these awesome tutorials.
@nanousis
@nanousis Год назад
Thanks for the good words man, I really appreciate it 🙏🙏
@hixomist9
@hixomist9 Год назад
Thanks man! you explained every code and physics very perfectly👍👍
@nanousis
@nanousis Год назад
Thanks, I appreciate the feedback 😊
@shaourkhan2881
@shaourkhan2881 2 года назад
You Explained it very well...nicely Done!!
@hta3139
@hta3139 Год назад
Very good video and the Github link, no bs and straight into the point. Sub earned.
@nanousis
@nanousis Год назад
Thanks for the feedback mate 😊
@Nismo3810
@Nismo3810 4 месяца назад
I get "error CS0246: The type or namespace name 'Mybutton' could not be found (are you missing a using directive or an assembly reference?)" why is that?
@worldbrix
@worldbrix 2 года назад
Hey, man! Thanks for the tutorial 👍🏻 What Unity version did you use in this video?
@nanousis
@nanousis 2 года назад
I used unity 2022.1.1f if I'm not mistaken on MacOs and URP pipeline
@emirhana61
@emirhana61 2 месяца назад
The warning "Your target platform mobile but not enabled realistic car controller" constantly appears every time I start the game. What should I do?
@dalastpotato7370
@dalastpotato7370 3 месяца назад
I have a problem with my car. I am using another car model but I did all the code correctly, but the car doesn't move as fluid in the video, and if go at a high speed, I can barely turn causing me to crash. How do I fix this?
@AleeshanMB
@AleeshanMB Год назад
Thanks, man! you explained every code and physics very ideally (Please try to avoid the Mick scribing sounds )
@huytrinh797
@huytrinh797 Год назад
wow so helpfully :O thank u, I'm really excited about your car controller tutorial :"3
@nanousis
@nanousis Год назад
Glad I could help you mate 😊😊
@andrewalexart
@andrewalexart Год назад
Thanks for your tut bro! One problem, I noticed when you moving forward direction and use -1 input of vertical axis it's working fine. But whae you 're moving back and trying to go forward it's not used brake at all. I fixed it with DotProdunt of two vectors: movingDirection = Vector3.Dot(transform.forward, rb.velocity); if (movingDirection < -0.5f && gasInput > 0) { brakeInput = Mathf.Abs(gasInput); } else if (movingDirection > 0.5f && gasInput < 0) { brakeInput = Mathf.Abs(gasInput); } else { brakeInput = 0; }
@nanousis
@nanousis Год назад
Thanks for the tip man, I'll update the GitHub script to reflect the change. I found it a bit too complicated to mention it on this already long video.
@guizera1347
@guizera1347 9 месяцев назад
best tutorial on yt, thanks!!
@pheonix4333
@pheonix4333 Год назад
Thanks for tutorial brother...it helps me a lot❣️ Can you make a video on race track like how car behave when hits race track walls or side barrier , and other obstacles And what kind of , a developer can face problems while making a racing game
@nanousis
@nanousis Год назад
I'll definitely keep that in mind for a future video. I am looking to address a lot of the problems someone may face when making a racing game.
@chhegurrumahindra2584
@chhegurrumahindra2584 4 месяца назад
I have a problem. 29:55 After following your steps and when I gave brake power value as 5000 then my car doesn't move. Brakes are applied automatically... can anyone help me
@loudris442
@loudris442 Год назад
Does this car take jumps well? Is there any downforce or centre of mass to the car? Does the car take jumps well?
@nanousis
@nanousis Год назад
It should take jumps well as long as you set up the suspension aspect of the wheel colliders correctly. The com is determined by the rigidbody and the colliders. You can change that on the rigidbody. Also I don't have any forces pushing down on the vehicle
@loudris442
@loudris442 Год назад
@@nanousis Also do you know how to Z axis movement, so the camera doesn't zoom too far away when the car is moving?
@razawarrior25
@razawarrior25 4 месяца назад
Hlo This problem iam faceing some solution for this nullreferenceexception object reference not set to an instance of an object car controller
@sontranngoc6128
@sontranngoc6128 Год назад
Thank you. everything is great, only 1 thing, next time please put the cam in the right corner, thank you again
@jionni3244
@jionni3244 Год назад
Hi, I have a problem. My car can move up, down, left and right, but my wheels doing some wierd things. They are like rotating around the car not rolling. It does like big circles around the car. Can you help me?
@nanousis
@nanousis Год назад
It's probably because the pivot point of the wheel is in the center of the vehicle. Try creating an empty game object, put it in place of the wheel and set the wheel mesh as a child of it.
@jionni3244
@jionni3244 Год назад
@@nanousis Hi, it didnt work but I created cylinder and rotated it. It looked like it solved the problem but there is another one. Now it rolls up and down and not sideways. Do you think u can help me?
@bmpproductions
@bmpproductions 10 месяцев назад
So I had added an Enter/Exit script onto my car and it works fine other than when i get out, my car continues to drive. Do you by chance know why or how to fix that issue? I know it isn't completely relevant to this video but of all the car controller tutorials I've watched, you are the best so I thought I'd ask if you knew how to handle my situation.
@furretkachu
@furretkachu 9 месяцев назад
You have to desactivate the car controller script, I had that same problem in the past
@redfinance3403
@redfinance3403 Год назад
I have a probem. When the gasInput is 0, the car continues accelerating and I am not sure how to stop this (such that when the gasInput is 0 the car is neither decelerating or accelerating but just remains at the current speed and will decrease over time due to drag, friction, etc
@nanousis
@nanousis Год назад
You can create some friction by either adding a force negative to the momentum or just add drag to the rigidbody component.
@redfinance3403
@redfinance3403 Год назад
@@nanousis Thanks for the advice but I realised that the problem was in the fact that motorPower was set to a really big value of 10000, so I reduced it to 1500. 🎉
@Saed_Safwan
@Saed_Safwan Год назад
Can i edit the drifting value i mean for example i want to build a rally game so all rally game have different cars i want to make some car drift less than other or even some of them cannot drift can i do that with this video?
@nanousis
@nanousis Год назад
Yeah most definitely, you just change the stiffness of the rear wheels depending on how much friction you want!
@skakun.design
@skakun.design Год назад
Excuse me, why does the car not pick up speed when the wheel is turned? Does it look like it's due to too much wheel angle?
@nanousis
@nanousis Год назад
Yes due to the big wheel angle for the drift if you max it out then you are going to have a hard time accelerating.
@skakun.design
@skakun.design Год назад
@@nanousis now I must to change curve, right?
@daiwang8111
@daiwang8111 Год назад
Hello i imported the assets folder in the project but all of the shader is pink (Hidden/InternalErrorShader), is there any fix ? Edit: i managed to fix it by changing all of the Hidden/InternalErrorShader to Standard, it restored the materials to original form. Edit: the ground texture remain broken (only white color) but the car and smoke texture is fixed Edit: changing the ground texture albedo to grey instead of white fixes it , no longer broken
@nanousis
@nanousis Год назад
Yeah, I use URP so if you import it on a non URP project it will appear as if the shaders are broken
@troedsn
@troedsn 11 месяцев назад
for some reason the gas and reverse kepps in full when i just press the button, so it doesnt stop when i let go of the button any suggestions?
@nanousis
@nanousis 11 месяцев назад
Are you sure you are resetting the value to 0 when you let go?
@krishsingaria7906
@krishsingaria7906 4 месяца назад
very amazing work
@Shoabu-ro2ur
@Shoabu-ro2ur Год назад
wow thanks so much man, really underrated
@nanousis
@nanousis Год назад
Glad I helped mate 😊
@furretkachu
@furretkachu 9 месяцев назад
Hi, I have a problem, the wheel meshes do not update, I have checked the code and nothing seems to be missing, so if someone could help me I would apreciate it
@NitinKr7
@NitinKr7 9 месяцев назад
Bro just change the wheel damping rate to 1, suspension distance to 0.1, spring to 70000, damper to 7000, and target position to 0.8 in wheel collider's property.
@furretkachu
@furretkachu 8 месяцев назад
@@NitinKr7 hey, I have gotten a pretty bad solution, but for the moment, it is working pretty well, it consist on making another script only with the part of the script that manages the wheel update, idk if I have explained myself, but I have that helps you, and if you have any doubt you can ask me
@superheroes2720
@superheroes2720 2 месяца назад
there is a error in this code help me out please😭
@TipAnimal
@TipAnimal 8 месяцев назад
Thanks to helping us! 😎
@MuhammadAbdullah-xk6hu
@MuhammadAbdullah-xk6hu Год назад
hi brother. My car is still rolling after applying the revers and brakeing process. What can be the error?
@nanousis
@nanousis Год назад
Probably the keybinds for braking are wrong.
@RUDERUDYTUTORIALS
@RUDERUDYTUTORIALS Год назад
Thank you buddy this is really helpful great content...
@nanousis
@nanousis Год назад
Glad I helped you mate
@maningningvines7965
@maningningvines7965 Год назад
Why the getworldpose in my pc wont work im getting the error cs1061 wheelcolliders does not containt definition for getworldpose
@nanousis
@nanousis Год назад
Hmmmm, are you using an old version of unity?
@RedcrystalTeam
@RedcrystalTeam Год назад
can you give the car prefab
@protonproductions
@protonproductions Год назад
Help! I have the same code and hierarchy as you but the wheels gets rotated sideways when I press play.
@nanousis
@nanousis Год назад
It is possible that the normals of the wheels are wrong, create a new game object (maybe use a cube to see how it rotates) and use it as a parent for the wheels so that the new object rotates the wheel.
@protonproductions
@protonproductions Год назад
@@nanousis HELP! The car steers sideways a bit when I hold the gas key[W]. Why is this happening?
@schnappifx7104
@schnappifx7104 Год назад
im tryiingto import it from github but unity keeps saying invalid project. what am i supposed to do
@nanousis
@nanousis Год назад
I would suggest you just import the asset folder instead. If that doesn't work go onto the new videos which is the improved version of that video file.
@schnappifx7104
@schnappifx7104 Год назад
@@nanousis it worked thanks.
@shaourkhan2881
@shaourkhan2881 2 года назад
Can You also make a detailed tutorial on Wheel Colliders, especially extremum slip, Extremum Value, Asymptote slip and asymptote value. Thanks.
@nanousis
@nanousis 2 года назад
Yeah I can definitely try and make one explaining the logic and physics behind the wheel colliders in unity
@shaourkhan2881
@shaourkhan2881 2 года назад
@@nanousis it would be great, because on youtube, i have never seen a video which explains wheel collider in detail and many of developers like me is facing this issue.
@nanousis
@nanousis 2 года назад
Great, I'll put it on the schedule for the next video
@nanousis
@nanousis Год назад
I wanted to let you know that I just uploaded a video detailing on how unity wheel colliders work and what each value does!
@tatschl4537
@tatschl4537 Год назад
hey man were you able to fix the understeering thing increasing the friction doesent seem to bee a good idea
@nanousis
@nanousis Год назад
You can decrease the rear asymptote and extremum friction to make it more prone to oversteer. Other than that by setting the center of mass better and choosing correct values for springs should fix it. If I remember correctly in the GitHub link where I have the mobile buttons I have set the car up to be more prone to oversteer.
@superheroes2720
@superheroes2720 2 месяца назад
how can i download your templet
@danco12332
@danco12332 Год назад
Bro what is MyButton class? its giving me error
@nanousis
@nanousis Год назад
It's the button handler, it should not throw errors unless you have a class named the same way
@danco12332
@danco12332 Год назад
@@nanousisdo i need it for mobile , how can i use it with pc
@abeiram8
@abeiram8 Год назад
how do i make it so that when the car is in reverse the camera does not flip to the front side. I want it so that i still see the back of the car when in reverse and not the front
@nanousis
@nanousis Год назад
Hmmm I would either add a check so that it doesn't move further forward. Something like if (distance of camera to car is bigger than 5) only then move the camera
@superheroes2720
@superheroes2720 2 месяца назад
can you give me the car controller code?
@superheroes2720
@superheroes2720 2 месяца назад
🥵
@reksafitrananda7704
@reksafitrananda7704 Год назад
great tutorial!
@nekojin1164
@nekojin1164 Год назад
Hello, i wanna try this tutorial after few days, so i wanna ask if these videos are in the correct order in the playlist, thanks ! i also subbed :))
@nanousis
@nanousis Год назад
The videos are in order that they were uploaded and they are the order that you can follow. I hope you find them useful on your journey 🙂
@vex123
@vex123 Год назад
Can you please make a part 2 on how to create a track / terrain?
@nanousis
@nanousis Год назад
I'll definitely look into it although that is beyond unity and more into 3d modeling. Thanks for the suggestion though 😊
@DerAua
@DerAua Год назад
Imphrenzia has a great tutorial on that.
@AudreyGingras
@AudreyGingras Год назад
Do you know how to use a controller joystick instead of the keyboard arrows?
@nanousis
@nanousis Год назад
I think get axis does this. If not you would need to change the gas input and break input corresponding to the joystic
@adityaajith5636
@adityaajith5636 2 года назад
Great video
@IslamicSnapshots
@IslamicSnapshots Год назад
It started laging when switch to high resolution please give a solution
@HAYATO_2
@HAYATO_2 4 месяца назад
thank you very much 😍😍❤❤
@justfortech1
@justfortech1 Год назад
sir can u tell how to make front tires brake disk brakes not rotate while the the tires are moving, but the disk brake should move right left
@nanousis
@nanousis Год назад
You would need a script that makes the brake disks follow the car and when you turn, to turn them left/right
@shortydudee1214
@shortydudee1214 Год назад
not sure what i did wrong, but when i hit play the wheel meshes decide to teleport to random places.
@nanousis
@nanousis Год назад
Probably wrong wheel colliders/wheel meshes origins
@nickolayfetlistov4416
@nickolayfetlistov4416 Год назад
Great video, thanks!
@skakun.design
@skakun.design Год назад
Thank you so much! Great work man!!!
@nanousis
@nanousis Год назад
Thanks mate 😊😊
@mervelerinevi6445
@mervelerinevi6445 Год назад
Hello my friend thanks for great video! I have question, when i press "s" and car is going back way the front wheels are shaking and i cant go right or left side how can i fix this problem
@nanousis
@nanousis Год назад
I have fixed it in future videos, just make sure that counter steering doesn't apply if the drift angle is bigger than 120 So If(driftangle>120) {Countersteer=0}
@beanladder281
@beanladder281 7 месяцев назад
Hi there, I don't know if you are still active here, I really loved your Tutorial, You gained a sub here, I was wondering can you tell me how to implement soft body physics destruction for my game? It is going to be a Demolition Derby kind of game.
@SuperPinkhell
@SuperPinkhell Год назад
any idea why the car slow then stops when steering ?
@nanousis
@nanousis Год назад
Probably due to big steering angle at low speeds. Anything above 50 is excessive and slows the car down
@SuperPinkhell
@SuperPinkhell Год назад
@@nanousis thank you , i lowered the curve and is better now
@mediaexposed6256
@mediaexposed6256 Год назад
hey dude thanks for these awesome tut series, can you make a tutorial related to replay system like asphalt 9 when race finished, a replay of race with all its events called ,, kindly make a detailed tut related to it
@nanousis
@nanousis Год назад
Glad you liked the tutorial, I can definitely look into making a tutorial like that, thanks for the idea!
@mediaexposed6256
@mediaexposed6256 Год назад
@@nanousis yes dear the way they implemented the mechanics of replay are so exceptional and i wish to know about it, thanks for considering it .
@Ali1ks
@Ali1ks Год назад
I just did what you did in graph but the car is moving but not the wheel plz solve
@Ali1ks
@Ali1ks Год назад
I copy paste the code i assume if there is any mistake i watch the video 3 times 😭but didnt help me
@abeiram8
@abeiram8 Год назад
check if the wheel meshes are correctly assigned in the inspector
@nenebaez4145
@nenebaez4145 Год назад
Hello as these, excellent video this controller serves for other vehicles for example a truck
@nanousis
@nanousis Год назад
Yeah, just change the weight of the vehicle and the motor power and you would be fine
@adolfomarro
@adolfomarro Год назад
Is it possible to do the same with 4 wheel indipendent steering?
@nanousis
@nanousis Год назад
Absolutely, you can just copy paste the code for more wheels that would steer.
@ScooterKid1530
@ScooterKid1530 Год назад
THIS IS GREAT!
@nanousis
@nanousis Год назад
Thanks man
@hugomachadopereira314
@hugomachadopereira314 2 года назад
Great !!
@nanousis
@nanousis 2 года назад
Thanks 🙏
@Ali1ks
@Ali1ks Год назад
Bro really great wrok but the wheels are not moving spent 1 hour on that graph but couldnt fix and i am stresfull with this plz help me solve this
@suddenleegaming
@suddenleegaming Год назад
I Followed throough your tutorial but used my own car asset my wheels are spawning away from the car on four different places.
@nanousis
@nanousis Год назад
It probably has something to do with the pivot points of the wheels, try to put them inside an empty game object that is going to be in place of the wheels and use that as the wheel mesh. Hope it helps
@suddenleegaming
@suddenleegaming Год назад
@@nanousis I took the car you provided and swapped the body with mine
@littledemo3605
@littledemo3605 Год назад
Ur discord not working re active link please.
@snuma8707
@snuma8707 2 года назад
Cool!👍
@spaww
@spaww 2 года назад
Awesome tutorial, but some textures don't work right, I fixed it with blender...
@nanousis
@nanousis 2 года назад
Thanks 💪
@TilenCurin
@TilenCurin Год назад
Are armature rigs even used for vehicles in games? I don't see anybody using them. Everyone just writes scripts for wheels.
@nanousis
@nanousis Год назад
Most of the high end assets use the wheel colliders physics from Unity to achieve realistic driving. Now if you want an even more realistic car, you can do it through scripts
@TilenCurin
@TilenCurin Год назад
Oh, I meant like armature or bones, such as for rigging characters. But using it for cars instead. Anyways, I think I'll just do it the way you do it. Thanks for your tutorials and for being so responsive!
@fatihsarbyk5273
@fatihsarbyk5273 3 месяца назад
github ling is not good . car is completly pink , no anothor color ? wtf
@montybear_8270
@montybear_8270 Год назад
It keeps saying I got a compiler error.. How do I fix it?
@nanousis
@nanousis Год назад
What is the compiler error you are getting? You can find it in the console.
@montybear_8270
@montybear_8270 Год назад
@@nanousis I found even more errors sadly.. it says "Assets\CarController.cs(59,41): error CS0266: Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?)" "Assets\CarController.cs(40,29): error CS1501: No overload for method 'Angle' takes 3 arguments" "Assets\CarController.cs(71,27): error CS1061: 'WheelCollider' does not contain a definition for 'steeringAngle' and no accessible extension method 'steeringAngle' accepting a first argument of type 'WheelCollider' could be found (are you missing a using directive or an assembly reference?)" "Assets\CarController.cs(72,27): error CS1061: 'WheelCollider' does not contain a definition for 'steeringAngle' and no accessible extension method 'steeringAngle' accepting a first argument of type 'WheelCollider' could be found (are you missing a using directive or an assembly reference?)" uh oh.. help
@montybear_8270
@montybear_8270 Год назад
nevermind but there is a weird problem with my car.. its not turning even though I copied everything properly... any fix?
@montybear_8270
@montybear_8270 Год назад
Hi sorry I have too many errors i will rephrase what I said.. So the car goes forwards and backwards which is fine but then while going forward and trying to turn to the left or right the car doesn't even turn left or right.. I need help and this tutorial is helping me alot..
@sharchikgamez2352
@sharchikgamez2352 Год назад
can anyone help with spawning smoke particles? smoke is spawning in wrong rotation and i can't fix it😥
@nanousis
@nanousis Год назад
Make sure the prefab and the particle system is set up correctly
@sharchikgamez2352
@sharchikgamez2352 Год назад
@@nanousis Okay! Thank you very much
@sharchikgamez2352
@sharchikgamez2352 Год назад
@@nanousis nothing changed( the problem is that the particles spawn in the opposite direction like 180° but in script i can't understand Instantiate value that spawns smoke in this direction
@Ali1ks
@Ali1ks Год назад
The tires of my car are not moving plz tell me the solution
@nanousis
@nanousis Год назад
You probably have messed up the wheel colliders, are you sure the wheel colliders are facing the correct way?
@Ali1ks
@Ali1ks Год назад
The wheel colliders and car are moving but wheels are not moving
@vibeduck17
@vibeduck17 Год назад
can you link the entire project files please (you only linked the assets folder and i really want the whole project folder)
@nanousis
@nanousis Год назад
Unfortunately that is not possible since project files are usually around 4gb. If the assets don’t work make sure you are using unity’s URP
@vibeduck17
@vibeduck17 Год назад
@@nanousis you could zip the file and upload it to google drive, but I was just having lots of issues which I don't really know how to fix and I don't have a lot of time so I can't go through the whole video. I'll try that out tho, thanks
@theelofiguy
@theelofiguy 11 месяцев назад
bro, how to add controller like red, blue, green to the object
@Ali1ks
@Ali1ks Год назад
Show me the other method of solving graph plz help
@AdamRajab-lc2cw
@AdamRajab-lc2cw 9 месяцев назад
Thank you
@superheroes2720
@superheroes2720 2 месяца назад
i will subscribe you
@onurakyildiz
@onurakyildiz Год назад
its amazing job, where can i find cars like on this video except for the asset store
@nanousis
@nanousis Год назад
The model was modeled by me. You can find similar models on turbosquid and cgtrader for free ones.
@minecraftmobile93
@minecraftmobile93 Год назад
How i get the thats smok package pleas😢
@nanousis
@nanousis Год назад
You can get it from the link in the description, it's on the GitHub. Hope you like it :)
@gamesandtechnology7135
@gamesandtechnology7135 Год назад
That's useful for me thanks.
@nanousis
@nanousis Год назад
Glad it helped mate 😊
@joker-hv3hb
@joker-hv3hb Год назад
Great
@ithanhunt3250
@ithanhunt3250 Год назад
*WHERE IS THE LINK TO DOWNLOAD GITHUB ??*
@nanousis
@nanousis Год назад
It's in the description. The link is github.com/Nanousis/CarControllerTutorial/
@rohithreddy4828
@rohithreddy4828 2 года назад
Super Broo
@nanousis
@nanousis 2 года назад
Thanks 🙏
@Deaker24
@Deaker24 Год назад
I put up a video to show what I learnt from your car controler
@nanousis
@nanousis Год назад
Cool stuff man, glad I helped 😊
@danco12332
@danco12332 Год назад
Hi bro can you please tell me if i want my car to have more power in 1st gear please tell
@nanousis
@nanousis Год назад
I guess you can change the gear ratio? Or increase the horsepower curve
@superheroes2720
@superheroes2720 2 месяца назад
using System.Collections; using System.Collections.Generic; using UnityEngine; public class car_contrallar : MonoBehaviour { public WheelColliders colliders; public WheelMeshes wheelMesh; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { ApplyWheelPositions(); } void ApplyWheelPositions() { UpdateWheel(colliders.FL, wheelMesh, wheelMesh.FL); } void UpdateWheel(WheelCollider coll, MeshRenderer WheelMesh) { Quaternion quat; Vector3 position; coll.GetWorldPose(out position, out quat); WheelMesh.transform.position = position; WheelMesh.transform.rotation = quat; } } [System.Serializable] public class WheelColliders { public WheelCollider FL; public WheelCollider FR; public WheelCollider RL; public WheelCollider RR; } [System.Serializable] public class WheelMeshes { public MeshRenderer FL; public MeshRenderer FR; public MeshRenderer RL; public MeshRenderer RR; }
@superheroes2720
@superheroes2720 2 месяца назад
if you give me the car controller code then i will subscribe you
@sanjayprabakaran8859
@sanjayprabakaran8859 Год назад
Bro car assets link send me bro 🙋
@nanousis
@nanousis Год назад
It's on GitHub
@sanjayprabakaran8859
@sanjayprabakaran8859 Год назад
@@nanousis okay 👍 bro
@sanjayprabakaran8859
@sanjayprabakaran8859 Год назад
Bro This code other Unity car assets im using but my cor wheel is not function
@msbrdmr
@msbrdmr Год назад
using System.Collections; using System.Collections.Generic; using UnityEngine; public class CarController : MonoBehaviour { public List WheelColliders; public List WheelMeshes; public GameObject centerofmass; void Start() { // GetComponent().centerOfMass = centerofmass.transform.position; } void Update() { updateWheels(); } void updateWheels() { updateWheel(WheelColliders[0], WheelMeshes[0]); updateWheel(WheelColliders[1], WheelMeshes[1]); updateWheel(WheelColliders[2], WheelMeshes[2]); updateWheel(WheelColliders[3], WheelMeshes[3]); } void updateWheel(WheelCollider col, MeshRenderer wheelmesh) { Quaternion rot; Vector3 pos; col.GetWorldPose(out pos, out rot); wheelmesh.transform.position = pos; wheelmesh.transform.rotation = rot; } } my wheels get away from the car slowly when I start the game and car flips over. Help please
@nanousis
@nanousis Год назад
You shouldn't rotate the position and rotation of the wheels, but you should use forces to make them move.
@weckar
@weckar Год назад
Okay. But collisions though? I mean, that's the hard part...
@Yellow_G
@Yellow_G 4 месяца назад
10:18 This time 🤣
@32poppasavage28
@32poppasavage28 5 месяцев назад
Man why tf would you put the face cam over the code
@Ali1ks
@Ali1ks Год назад
Plz reply 😢
@nanousis
@nanousis Год назад
I did reply, I don't have enough information to help you further
Далее
How I made my own Arcade Racing Game
6:15
Просмотров 83 тыс.
Wheel colliders Explained! Unity + GitHub link!
18:29
How to Create Road Tracks Using Road Architect in Unity
14:58
Arcade Style Car Controller || Unity Tutorial
21:20
Просмотров 92 тыс.
How I Would Start Game Development (If I Started Over)
16:59
Simple Car Controller in Unity Tutorial
12:38
Просмотров 327 тыс.
3 Hours vs. 3 Years of Blender
17:44
Просмотров 5 млн