Search Unity

[Free] Arcade Car Physics

Discussion in 'Assets and Asset Store' started by saarg, Nov 5, 2018.

  1. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Arcade Car Physics

    Arcade car physics is a set of scripts and prefabs made to help you add cars, tanks, truck or any type of wheel vehicle to you game. You can use one of the four prefabs to add some gameplay to your prototype or test a feature but the scripts are also customizable enough through the inspector to be used on a full race game.


    Demo builds

    Screenshots




    The car models are made using asset forge and kenney's collectio
    n of free assets.

    Tutorial


     
    Last edited: Apr 19, 2019
  2. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Any video of the assest in action??
     
  3. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    I'll consider making a video soon but I'd recommend testing the demo scene or autober as it's difficult to get a feel of the gameplay from a video.
     
    Mark_01 likes this.
  4. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    As suggested I've added a demo video and took some time to make a demo build you can find here:
    https://github.com/Saarg/Arcade_Car_Physics/releases

    The demo builds have the proper input to be used with a controller and I highly recommend using a controller.

    I haven't tested the mac build as I don't have one.
     
    Mark_01 likes this.
  5. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    Been playing around with this, it's pretty good!

    Looking to integrate a top down fixed approach where the car drives the direction you're pointing. So if the car is facing up and you hold the "D" key or right arrow key it will turn and drive to the right side of the screen. Have you implemented something like this or know of what might be the best approach?

    Thank you!
     
  6. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Hey maxaud,

    I haven't tried to use my asset for a top down controller but if you uncheck isPlayer it will stop listening to inputs and you can write your own controller as I believe I've left access to Throttle and Steering from script. I think the current version might be missing access from scripts to Drift but this is coming in the next update.

    Maybe we can work something together and have it in a future update.
     
    Mark_01 likes this.
  7. ZpetsnaZ

    ZpetsnaZ

    Joined:
    May 21, 2016
    Posts:
    10
    I love the physics! Just waiting for the fix for the multiple Controllers and I will gladly pay to get this package if there is an upgraded pack coming out.
    The issue: Jump, boost etc. is not isolated to one player. All the players jump if I am pressing jump.
     
  8. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Hi ZpetsnaZ, not sure why my code would make all cars jump with the same input but I guess it's probably that you either have the same inputName for all players or your inputs in Unity's input manager isn't configured right.

    Feel free to send me a link to you project in private if you want me to check it out.
     
  9. EndingCredits

    EndingCredits

    Joined:
    Aug 10, 2017
    Posts:
    2
    Thanks for this! Do you think this could be a good starter for implementing ridge racer style arcade racers, or are they a very different beast? (certainly accurate physics seem a little unconductive to the whole 'rail drifting' thing)
     
  10. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Hi,
    You definitely can use this asset to do something similar if you are willing to deal with the physics of the car but a physics based gameplay like the one here will feel sloppy from what I think you mean by ridge racer game.
    You'll for sure have to work on the drifts.

    I'd say you'll have more success with something else that's not using Unity's wheel colliders
     
  11. EndingCredits

    EndingCredits

    Joined:
    Aug 10, 2017
    Posts:
    2
    Do you know how the driving physics work in those games actually works? I'm quite familiar with the physics sim-style racers (at least the theory behind them, if not how they are implemented in practice), but can't really find a good starting point for other styles.
     
  12. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Sorry I can't help you on this I only worked on physics driven vehicles.
     
  13. MariaEugenia78

    MariaEugenia78

    Joined:
    Feb 16, 2019
    Posts:
    1
    Thank you for this beautiful asset! Unfortunately I'm having trouble with the speed, it goes negative when I press play (I'm on the demo scene), I selected one car to play but it still doesn't work. Which variables should I change?
     
  14. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    I'm guessing something on your inputs needs to be changed have a look at the inputs name in the cars and make sure it matches input in your project input manager.

    It's also possible you have a controller plugged in that's sending ghost inputs.
     
    Mark_01 likes this.
  15. unity_groQha9CSzhGrA

    unity_groQha9CSzhGrA

    Joined:
    Dec 30, 2018
    Posts:
    1
    The compiled demo works great! Love the feel of the cars and am trying to use it in a simple game.

    I can make the vehicle turn, jump, and turn the boost on, but cannot accelerate. The Up arrow and W will cause the throttle value to increase but the vehicle will not move. Any idea what the cause may be?
     
  16. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    you probably left the handbrake to true
     
  17. John1515

    John1515

    Joined:
    Nov 29, 2012
    Posts:
    248
    Hey, I think your asset is really awesome! I'm trying to make a simple AR game now, but need to scale down the cars (because they appear 1:1, while I rather use toy cars).
    Scaling makes the physics behave weirdly, do you know what I should check when scaling the cars down? (to about 1:10)
    PS: I also had the handbrake problem, "solved" it by removing it from the script. I couldn't find out why it kept being activated.
     
  18. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Hi, I have to admit that the cars don't really scale as well as I'd like. I had a go at scaling up the car the other day for someone else and you can scale them as long as you also scale the motor torque and brakes too, the behavior changes a bit but it stays pretty close.

    I'd try the same when scaling down but if you scale down a lot I'd expect some weird behaviors from the wheelcolliders. My advice would be to scale the world up instead of scaling the cars down that would also make everything easier to work with in the editor imo.
     
  19. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
  20. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    327
    Hi @saarg,
    I want to test drift physics on the extended version before decide buy it or not, how i can test it ?
     
  21. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Hi @CoderPro the drift car should be in the demo I linked in my post, I'll make sure it is in it during this week when I get a chance. The Drift car is also in the webgl demo but the webgl build is not very stable, for some reason the behavior sometimes changes between loads.

    The extended version's drift is the same as the free version anyway, the drift car is just an extreme example of how to setup a drift car.
     
  22. NSDrowned

    NSDrowned

    Joined:
    May 6, 2016
    Posts:
    4
    Hello @saarg
    I just started testing your engine. Love it!

    Quick question... any idea why my cars seem to always try to steer right?
     
  23. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Hi, if you put to much power on the front wheels you get torque steering which might be what you're talking about.
     
  24. NSDrowned

    NSDrowned

    Joined:
    May 6, 2016
    Posts:
    4
    Power is on the back wheels. I lowered the torque and it still behaves misaligned, always trying to steer right. Here's a video of what happens.



    As soon as I hit play the front wheel colliders change their angle a bit (i'm not touching any input).

    BTW, thanks for your help @saarg =)
     
  25. NSDrowned

    NSDrowned

    Joined:
    May 6, 2016
    Posts:
    4
    I think I figured it out... my turn input curve was all wrong. I couldn't see in your video tutorial that the bottom value was -1, -1, middle 0,0 and top 1,1... had them all above 0. Thanks for your help again :)
     
  26. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Nice catch, have fun with it!
     
    NSDrowned likes this.
  27. borjanews

    borjanews

    Joined:
    Feb 27, 2017
    Posts:
    11
    its optimized for mobile? i like to do car chase in android
     
  28. borjanews

    borjanews

    Joined:
    Feb 27, 2017
    Posts:
    11
    how i can changue the controls to put in screen?
     
  29. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Hi, I don't work on mobile so it's not optimized for mobile but it should work fine.
    If you want to use custom inputs for mobile you can set IsPlayer to false and use the Steering and Throttle properties from a script to control the car
     
  30. Xain

    Xain

    Joined:
    Aug 3, 2013
    Posts:
    68
    Hello I have locked the Y and Z rotation on the rigidbody but my car still rotating when I drive. Any chance you can tell me why it's happening? Love the asset btw
     
  31. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    I'm not sure what you mean by rotating but you shouldn't lock rotations on the rigidbody. Lowering the center of mass and increasing the suspension spring can reduce roll if that's your issue. Also in my demo the cars are a bit small, larger cars are more stable.
     
  32. Deleted User

    Deleted User

    Guest

    Good asset! Can I use it for my game? (It's non commercial)
     
  33. YektaOz

    YektaOz

    Joined:
    Dec 23, 2016
    Posts:
    6
    great asset.
    i have one question.
    in mobile when i touch the screen with 2 fingers, the boost is activating. how can i disable it ?
     
  34. saarg

    saarg

    Joined:
    Mar 9, 2017
    Posts:
    31
    Hi, I have no experience with mobile inputs at all so I'm sorry I cannot help you but everything you need to control the cars is exposed in the WheelVehicle script to write your own input logic.
     
    YektaOz likes this.
  35. YektaOz

    YektaOz

    Joined:
    Dec 23, 2016
    Posts:
    6
    Thanks I solved it just by editing your script and inputs. Thank you for this great asset btw
     
  36. Paul-Chimp

    Paul-Chimp

    Joined:
    Dec 11, 2018
    Posts:
    1
    Hey Saarg, thanks for the free asset!

    In the WheelVehicle script, shouldn't the Steering property be multiplied by steerAngle if you want to control the car externally?

    upload_2021-2-9_10-31-14.png
     
  37. dwomack734

    dwomack734

    Joined:
    Apr 16, 2016
    Posts:
    1
    Thanks for the asset!!
     
  38. jared-liam

    jared-liam

    Joined:
    Mar 8, 2022
    Posts:
    1
    can you share the script, i'm new to unity