Racing Game Guide #3 [ My Suspension method And Logic ] | ashdev

Поделиться
HTML-код
  • Опубликовано: 9 ноя 2024

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

  • @StudioTatsu
    @StudioTatsu 3 года назад +10

    Impressive approach. My method was very similar when I started. Raycast wheels and Unity default wheel colliders have serious downsides.
    Also, for an easier setup - create a scriptable object to hold the values of your position spring and damper values.
    That will basically save your values so you don't have to memorize them.

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

      I did 😉 thanks 👍

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

      Bro i saw your videos already. You did a great job. Actually i also wanted to make like yours but i don't have much experience. Can you please tell me or guide me what steps you took. Please ❤️

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

      @@ashdev Like I said, I started the same way you did, our approach isn't that different - The biggest difference is I created a dynamic collider system that detects and handles collisions different from the standard unity way. You're on the right track. Just keep going. I'll be watching. :)

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

      @@StudioTatsu thanks 👍❤️

    • @ashdev
      @ashdev  3 года назад +2

      @@StudioTatsu but your vehicle physics is so realistic. How you made it. Any guidance

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

    i was the one who gave pocket wheels the idea of grappling hooks in a car gam! so stoked to see someone talk about that game!

  • @tauheedgamedev2388
    @tauheedgamedev2388 3 года назад +4

    Great explanation of torque and why it important. Also I really like the monster truck and course.

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

      Thank you so much. Glad you like it.❤️

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

    Man, you just save me from missed deadline. BIG THANKS!!!!

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

      Nice 👍🙂

  • @TheSicklyOne
    @TheSicklyOne 3 года назад +7

    Great video! I'm struggling with finding a formula to calculate the opposite force to be applied. So traction can be applied. Also is that force applied directionally in a diagonal way or is it just applied from the side? I really really like the outcome you achieved and a the whole traction bit is confusing for me.

    • @ashdev
      @ashdev  3 года назад +2

      Its just a sideways force directly on the main car body. And it applied when the sideways velocity is greater than 0. You can control the amount of force as you like. You can control it like how fast the car is moving sideways and what amount you have to add. The force direction will be opposite of the sideways velocity

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

      And i also made a vehicle physics asset. Watch the 3rd 4th latest video on my channel. If you want a full vehicle physics implemented. Then get it. Otherwise you can make your own. You can join my discord if you have any questions.
      discord.gg/8wJ6Zdfq

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

      @@ashdev hello where do i find the 4th video

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

      @@superfunnypranks463 not yet made

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

      ok

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

    Interesting approach!
    I'm also trying to build a monster truck but I was using HingeJoints and their motors to drive the wheels. Well, it does not really work at all. The wheels start slipping even at low speeds and the truck does wheelies. Low or high friction, nothing really works. The rather complex suspension setup with the joints creates all kinds of problems due to imperfections in the physics simulation. I tried to do a naive but "realistic" implementation, but probably this really has to be faked to work as intended.

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

      I got it by the way. ruclips.net/video/iHB9uBNGJAQ/видео.html

  • @DevNoob
    @DevNoob 3 года назад +6

    Great how u used such awesome examples!

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

      Thank you brother ❤️

  • @pharos640
    @pharos640 2 года назад +2

    Thank you I was searching for a video like this one for days.

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

      happy to help

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

      ​@@ashdev I want to ask you how you implement steering so that it works with the configurable joints suspension? I think in this situation I need to make the front wheels rotate at the given angle and then add a force to the wheels in the direction they are facing but I can't get it to work.

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

      @@pharos640 this is arcade physics. I am adding force and torque directly on carbody to move and turn. Wheels are just there for suspension. And the meshes of wheels which are child of wheels rigid body i am rotation them according to speed. And turning their local rotation.

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

      Abd by the way this is available as a asset on asset store. Check description.

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

      @@ashdev Thank you for the information and im going to check the asset.

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

    Great explanation. I was looking for a long time to make car controller like this.

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

      There you go 👍 feel free to ask questions

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

      @@ashdev Yeah sure......👍
      Can't wait to see more of these tutorials

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

      @Chawel William explaining coding will take a lot of time bro . Actually i made a playlist ( useful videos ) there is a video explaining code. You can check it and see how to write code. And mix it with my suspension method

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

      @Chawel William I have college and working on a game so can't make such big video.. i am guiding you here. Maybe after my college i will be able to do youtube full time ❤️

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

    Thank you very much for the shoutout! I really like your method, it seems to be very flexible and looks really good.

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

      Thanks ❤️

  • @rankor6110
    @rankor6110 5 месяцев назад

    ok, you made the suspension of the car, but how do you make the wheel spin?

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

    Thank you, I have been looking for this lesson for many years

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

      U R welcome ❤️🖖

  • @vladlem4307
    @vladlem4307 3 года назад +2

    Can you do a lesson about the car controller physics?

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

      What do you mean by car controller physics. I think i explained that in this video.

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

      @@ashdev Do you apply rotation torque to car rigidbody or apply force to wheels? How do you rotate car?

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

      @@vladlem4307 as i mentioned in this video i use torque directly on car body ,not on wheels. Wheels are just there for suspension. Don't do anything with wheels.

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

    This is pure gold, thank you

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

    this is so simple and clear. Great video!!

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

    Can you please create a tutorial on 2D bike stunt game like Trial Xtreme, Trial Rising, etc. 2D game with 3D models. There is absolutely no tutorials on this topic and no assets at all.

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

      I am making a asset tho... On 2.5D you can check my Instagram for video.
      instagram.com/ash_dev18?igshid=1i8lkx42xed8m

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

      @@ashdev Thank you, then I will wait for your asset. But I didn't able to find the video on insta. One more thing, In the video is this your original voice? Or you are using any tool or something?

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

      @@Only4GamersXyz its Text to speach(AI generated). I was using a free trial but now its not available. So i use speechelo now. Paid....
      The insta video is not with bike but its same as bike. 3rd video. Its not a good showing video but u can get an idea. You see the bike physics on the youtube? U can use that as 2d. And also if you want a 3d racing physics as explained in the video , i made a asset called Ash vehicle physics. You can check it too.(incase you need that in future)

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

    how did you Rotate the wheels when you set their angular motion locked?
    thank you

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

      also which rigidbody function did you use to add force

  • @ahmd-salh
    @ahmd-salh 3 года назад

    Your game looks nice. I haven’t tried the configurable joints method before but i imagine it wouldn’t handle collisions very well. have encountered any issues with it?

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

      Yes but i solved them. You can play a demo i made. Its in the description of one of the latest videos. And also made a asset with it.

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

    Hi Ash, what is the blue contour around the tires? Is not exactly an outline.. it´s like a light..
    How can I search to learn about this?? Post processing?
    And when you´ll realese Vehicle Physics 2?
    Thanks!

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

      I don't know what you are talking about. And i have released sim-cade vehicle physics.

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

      ​@@ashdev Hi again!
      In 6 min video, when the car makes stunts on the ground, the tires have a blue contour.
      I thought a cool effect!

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

      @@BOT1001_ thats not effect just lighting. And its material has smoothness

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

    I have two questions:
    How do you calculate the sideways component of speed?
    And do you know how to spin the wheels appropriately? I noticed you suggested, in replies to comments, to apply rotation according to speed. I think it should also depend on whether the accelerator is pressed or not, and on how "drifty" the car is supposed to be (i.e. wheels should spin more when there's less traction). Do you know a simplistic way to calculate this stuff?

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

      This is a arcade controller so all the details dosent matter that much. And the actual colliding wheels are not rotating the are sliding and its child meshes are rotating according to the speed. And when the camera is behind or in driver seat we can see the wheels. You can check my other videos how its looking. And also you can play a demo it will be in the description of one of the videos. And also i made a package of this vehicle physics. It will also be in description.

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

      Also the sideways component is how much velocity the car has in the side axis of car. Transform.right

  • @ИванИванов-д5з1ь
    @ИванИванов-д5з1ь 2 года назад +1

    Cool stuff, thank you for the tutorial

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

    Hi, very nice explanation! I'm also a bit confused, as there seems to be different advice for which technique is better suited for arcade physics.
    I'm using Unreal Engine 5 with Chaos physics. And although it is easy to set up and going (it's kind of like you described here, with the bones method), it's is difficult to get an arcadey feel out of it. Although I can easily adjust he friction of the tyres to either slide or grip, it's all too sim-like. Others suggested to go for raycast or even a large sphere around the car, but your video shows that it can be done without those.
    Chaos even as options to get 'arcade-control' out of it, but is lacking in documentation what each setting is for. I was only able to find out what effect the stabilize controls had. For which I could see through the debug, it was actually creating a force in the opposite direction the car was trying go because of the physics, to counteract the control. Which does a good job at stabilizing the car and also keeping it grounded (if you checked the Z-axis aswell). So I'm actually quite close to that arcade control. Problem is, although I can get the car to drift with pulling the handbrake, it also loses momentum/speed, which makes it a pretty short drift. I need my cars to handle like in Split Second: Velocity. Steering should not decrease the speed and drifting should be able to be done while continue moving forward.
    Since you're working in Unity, you probably can't help me directly, but do you know of helpfull resources which can help me set it up? Most I come accross are just showing their demo, but not showing how they done it. Coding isn't my strongpoint anymore, so I'm trying it with a combination of the Chaos physics and BluePrints.
    Cheers.

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

      ruclips.net/video/LG1CtlFRmpU/видео.html

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

      ruclips.net/video/Db1AgGavL8E/видео.html

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

    Hey man, the video's great. I wanna know as to how you got the wheels turning. I added a simple script to the car's root parent object that performs an AddForce function, but it doesn't move because of the wheels.

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

      Yes wheels are not rotating... Make a child object to wheels and add wheel meshes in it and rotate it according to the speed of the car.

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

      @@ashdev What about the steering? I was able to code friction for forward and backward movement, but steering is still slippery as hell. Did you use any equation for adding friction for steering?

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

      @@L3RNA3AN use tranform.rotate

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

    Hi
    I don't understand how by blocking the rotation of the wheel it can turn/roll by applying a force. Personally I locked the motion of the configurable joint like you said (and put a physic material) but the wheels don't want to turn despite the movement of the vehicle ...
    and if i put the motion to free, it do anything

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

      U have to rotate the wheel mesh seperately. Make the physics body and mesh body different. And rotate the mesh according to the speed of car

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

      @@ashdev oh ok thanks 👍😄

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

    How did you turn the wheels with Rigid body?. If I turn the wheels, the car would go flying, I froze the unnecessary rotations but still doesn't work. But suspension and Forward-backward movement works. Please help me with the rotation of the wheels.

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

      Make the wheel mesh and rigidbody different and rotate the mesh according to the speed of car

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

    Do you believe such a setup can work with two or one-wheeled vehicles, like bikes (what about balance?) or even hovervehicles?

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

      Yes bro i made it ... Watch the latest videos

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

    After following the instructions, my wheels slide along the car body - any idea why that's happening? The suspension works well, but eventually the car slides forward, as if it's sitting on top of the wheels instead of actually connected to them.

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

      Ya the wheels will slide .you have to add 0 friction to wheels. And separate wheel mesh and rigidbody. And rotate the mesh according to the speed each frame. I also made a full vehicle physics asset. You can check description. Ash vehicle physics.

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

      @@ashdev thank you!

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

    Hello, do you know what is the difference between raycast and joints from a performance point of view? I work on mobile and performance is very important.

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

      Well to use joints you have to use rigidbody. Then you have 4 extra rigidbodys for wheels it will effect performance but in case of raycast there you need 4 extra raycasts then. I don't know raycast uses more calculation or jionts but i also tried on mobile and works fine no lag so far... I will test this further tho and make a video later 👍

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

    what a great tutorial

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

    How do you figure out how much force is applied to each wheel, so you can apply the correct forces when driving? With a raycast suspension, you can just use the forces you apply to the car in order to get it to the correct position, but I can't figure out how to determine the correct forces when using a configurable joint.

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

      Follow the exact steps discussed. You will find your spring value by trial and error. Watch again and you will get it.

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

      @@ashdev What I meant is: What formula do you use to calculate the lateral forces on the wheels when turning? How do you get the normal-forces applied to the wheel by the ground? With a custom raycast-suspension from car-body and straight down, you get the value automatically (as in the forces the suspension applies to the car body to get it to not hit the ground), but the Unity Joint doesn't seem to allow fetching that value.
      Btw. I much appreciate that you take the time to answer questions :-)

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

      @@thorhelms2634 no i am not using raycast. Thats the thing . For suspension you dont have to code. You have to attach configurable joints to wheels and the connected body will be the mein vehicle rigid body .did you watched the video carefully? I gone too fast i guess. You have to lock every motion except the y motion in joint settings. Then y drive settings... Works as a spring.

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

      And when turning ,i mean if the sideways velocity is nonzero then we add a force on the car in the opposite direction of the sideways velocity. And the amount will be set by you.

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

      @@ashdev The video is fine, I'm asking about stuff that is outside the scope of the video :-) When turning, how big are the forces you apply to the car? What formula do you use to calculate that force?

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

    Hey man this looks great! Are you still planning to make an asset on the assetstore? If not I would like to buy this monster truck example from you.

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

      Already made. Link in description. "Ash vehicle physics"

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

    devious

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

    Hey just wanted to ask if the angular x motion is free and if not then how do you rotate the wheels.

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

      Not rotating the rigidbody. But rotation the mesh. Its child

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

    How do you steer the front wheels so the car can change direction?

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

      I turn mesh of front wheels. But has no effect on physics.
      I add torque directly on car to rotate car.

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

      @@ashdev Thank you very much

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

    Wouldnt turning not work cause with sideways friction it would just stop current momentum but not transfer it into the desired turn?

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

      We are adding sideways force depending on sideways velocity. So its not letting vehicle slide sideways. Its just cancelling sideways moment. And we are adding forward force so it will result in a turn if we add torque to vehicle.

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

      What if your rolling tho? Would you have to add small torque every time your rolling?

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

      I mean if im not applying torque to the vehicle and its just sliding. Or are you supposed to add forward friction too just like sideways?

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

      Nvm just rewatched your explanation for turning : ( im dumb

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

      @@Zoomrail there is no forward friction here. If vehicle is just sliding sideways the force will stop it. In sideways direction

  • @martinvanstein.youtube
    @martinvanstein.youtube Год назад

    2 years latuur .. any chance of a more in depth tutorial?
    Most have either wheel colliders or like a single sphere collider ... and that is either very cmplex or very limited in scope (so when you add a jump or boost those controls tend to flip out ...also very limited control over the look and feel)

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

      I am going to make a video but don't know when. It will be on how i made my sim-cade vehicle physics asset.
      Method discussed in this video is used in my ash vehicle physics package. Link in description.

    • @martinvanstein.youtube
      @martinvanstein.youtube Год назад

      @ashdev honestly looking at all the paid tutorials , if I compare that with your asset (just bought it from the unity store) ... I would buy a tutorial you'd make on this subject in a heartbeat.
      I am not even talking about level building or track logic etc ... just how to build a proper car rig would be enough 😀
      I tried to reverse engineer it... but it is a bit beyond me ... I did manage to hook in gamepad controls and a custom function ( turbo boost)... but that is about it

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

      @@martinvanstein.youtube i think i should make a course on it. Lot of people are asking for it. I was thinking about it also but it takes lot of efforts. I will have to learn how to talk and make a script for the course.

    • @martinvanstein.youtube
      @martinvanstein.youtube Год назад

      @ashdev yeah you should :)
      Just use this video as a template , as you explain how it works on a toplevel pretty well... and then expand on it... don't worry about the voice or how you talk either.. the quality of your work is good enough to compensate for any accent!!!

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

      @@martinvanstein.youtube thanks i will 👍

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

    Why don't you use wheelcollider?

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

      Did you used them? If you do then you know how weird/bad they are. Very hard to get them right. And does not behave as we like.

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

      @@ashdev I did and that's why I asked. my car shakes back and forth like crazy and so did my camera. it's driving me crazy. but when I tried using unity 2018 its better, but unity 2018 is not good with URP

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

      @@dianjakap4805 thats the problem

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

      @@ashdev I wish you would teach me step by step (code wise) how to make playable car just like in the video. I just started learning unity and blender and the wheelcollider destroyed my motivation

  • @mateusdsp6871
    @mateusdsp6871 9 месяцев назад

    Good video!
    :D
    Jesus is coming back, God bless!

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

    Can you also make a script for it

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

      i made an asset of it link in description.

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

    could you make a downloadable file , so we can clearly understand the script and other all parts , thank you

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

      Sorry but this vehicle physics is available as a package on unity asset store. You can check the link in description.

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

      Can you share the script atleast?

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

      @@sri_j1683 bro scripts are the main part of it

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

      @@ashdev ya 🤣 no problem thank you , great video .

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

    can i have the code

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

      Its available on asset store. Link in description

  • @mehdibashirinejad7798
    @mehdibashirinejad7798 11 месяцев назад

    i invite to see my game if u like

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

    You are from India? right.
    but your accent looks like american

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

      Haha 😂 its not my voice... Its ai generated text to speech

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

      @@ashdev I am on your discord come live

  • @HexzGMD
    @HexzGMD 2 месяца назад

    ashdev copyer

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

    hey just wanted to ask.
    is this how you hanled friction?
    Vector3 frictionDir = new Vector3(-rb.velocity.x, rb.velocity.y, rb.velocity.z);
    rb.AddForce(frictionDir * Friction);

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

      Your concept is correct but implementation is wrong. That rb.velocity is in world space. You need in local space. Force direction will be car.right or left. Depending on sideways velocity (which side its sliding). And magnitude depends on you.
      By the way this has been implemented in Ash vehicle physics with more functionalities (link in description). If you want to see full code you can get it.

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

      @@ashdev ok thanks for the explanation really helps out. thanks.