Search Unity

Tiny Car Controller - official thread

Discussion in 'Assets and Asset Store' started by DavidJayIndie, Mar 24, 2020.

  1. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    Asset Store link

    https://assetstore.unity.com/packages/tools/physics/tiny-car-controller-151827

    Description

    This controller allows you to create and control a basic vehicle with fully configurable, arcade-like physics.

    Instead of having a body with four separate wheels, which is often needlessly complicated and prone to glitches, this controller is composed of a single rigidbody and sphere collider, similar to a character controller.

    Features
    - Easy one step setup
    - Control acceleration, speed, drifting, slope limit, collisions, and more
    - Change surfaces parameters to create for instance ice, mud, etc.
    - Lightweight, perfect for mobile games
    - Includes scripts to take care of input, visuals, and camera
    - No risk of flipping over
    - Can be used for any type of vehicle

    Have suggestions or concerns? Feel free to let me know in the comments!

    Screenshots




     
    oidafux likes this.
  2. MnzSoftware

    MnzSoftware

    Joined:
    Jun 14, 2016
    Posts:
    6
    A mac versione demo?
     
  3. IgorNovik

    IgorNovik

    Joined:
    Dec 7, 2017
    Posts:
    3
    How the car collides with obstacles and environment? Sphere collider or own Box(Mesh) collider?
     
  4. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    @MnzSoftware : I can try but I have no way to test it since I don't own a mac.

    @IgorNovik : The controller itself is a sphere but you can add colliders on the sides if you'd like the car to collide realistically with walls and such.
     
  5. sinkillerj

    sinkillerj

    Joined:
    Feb 11, 2020
    Posts:
    2
    The better option may be WebGL, that's the direction most seam to be going with demos these days and it should work on all major platforms.
     
  6. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    Hi, Do you have any plans to add the AI into the controller so that cars can search and smash?
     
  7. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    @dev_2051 I could potentially make a "pro" version with AI and racing mechanics. I've been thinking about it, but I can't yet say if or when it's going to happen.
     
  8. sinkillerj

    sinkillerj

    Joined:
    Feb 11, 2020
    Posts:
    2
    Until that happens I'd suggest taking a look at the AI car from Unity Standard Assets. It comes with a very simple to use pathfinding system, and the scripts are easy to adapt to this controller. Right now it is what I'm using. This video gives a pretty decent overview:
     
    adrog6666 and DavidJayIndie like this.
  9. shubhank008

    shubhank008

    Joined:
    Apr 3, 2014
    Posts:
    107
    umm no documentation is included, like none at all ?
     
  10. shubhank008

    shubhank008

    Joined:
    Apr 3, 2014
    Posts:
    107
    A few questions:

    1. How can I manipulate the speed of the car (aka apply speed boost) ?
    2. Does this asset provides API or methods to make modifications to things like speed or apply rotation, etc. to extend the functionality and integrate with our own code, without modifying your code itself ?
    3. How do I control how fast the car turns/rotates ?
    4. Possible to not use sphere collider ? My game/car needs cars to go through each other and not actually collide, so only colliders I use are trigger colliders, but now using a sphere collider is causing gameplay problems
     
  11. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    @shubhank008 I did include a readme file but I'll be the first to admit it's not much. I'm going to work on a proper manual as soon as I get the time. I'm just busy all the time haha

    Regarding your other questions;
    1. You can increase the maximum speed and acceleration for a while, that should do the trick.
    2. More or less. Technically the script TinyCarPlayer.cs is just a template, so you can make a copy and tweak it and it shouldn't interfere with the controller.
    3. Change the value of TinyCarController->maxSteering. The higher the value, the faster the car will turn.
    4. You can change the collision layer of the controller and uncheck it in TinyCarController->collidableLayers to make sure the controller doesn't interact with itself.
     
  12. Tvisvarson

    Tvisvarson

    Joined:
    Mar 20, 2018
    Posts:
    4
    Hello, i wanted to ask if the controller in general, in detail the surface parameters work for terrain / terrain layers.
     
  13. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Hi I bought this because I thought it referred to being a tiny car, not a tiny amount of code. I want a very small car to be able to drive around my existing world. When I size the car down and adjust speeds etc, it stops workign properly. Like I cant control the car once it hits a wall or something. Is there anyway to make this a tiny car but maintain all the controls etc?
     
  14. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    @DavidJayIndie Lovely work on the controller! Is it possible to add an option to tilt the vehicle forwards when falling? Right now it flattens out and looks a little strange when falling downwards. A tilt forward limit would be excellent for this.

    I was able to change the size okay by changing Collider Radius to 0.5 and scaling the visuals object to 0.25.

    upload_2020-9-10_10-34-19.png
     
  15. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    I have been using the Constant Force component with a relative Z force for a rocket boost, which is handy if you want to boost from ramps.
     
  16. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    It should work fine by changing both the radius and skin width parameters. The skin width should only be a small fraction of the radius to work properly. Maybe that's your issue here.

    Sure thing! I actually plan to add this option in update 1.5, which should come around October.
     
  17. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    The collider seems to be locked somehow, to radius 2, unable to adjust it. Also what is the visuals object?
     
  18. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    How do I adjust the radius, and where is "skin width"? I cannot see that anywhere.
     
  19. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    This is what I meant. You need to change the parameters in the TinyCarController script.

     
    radiantboy likes this.
  20. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    thanks man, so what value should I use for skin?
     
  21. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Thanks ive been playing with the values, it does seem to work much better now. One problem is when I hit a tiny bump (like the edge of a cube that is slightly higher), the car fails to get over it, is there a parameter to fix this? Also once this happens im stuck and I cannot reverse.
     
  22. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Yeh doesnt really work to be honest, but for 5 us I guess that's fair enough.Feel cheeky asking for a refund but really doesn't work well when you shrink it down.
     
  23. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    I'm sorry it didn't work for you. I wish I could have helped but it's probably a combination of very specific conditions that just don't work well together. I'll do my best to make it more flexible and easy to customize in the next update.
     
  24. Tvisvarson

    Tvisvarson

    Joined:
    Mar 20, 2018
    Posts:
    4
    Hello, i wanted to ask again if you don't mind, if the controller in general, in detail the surface parameters work for terrain / terrain layers.
     
  25. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    Oh sorry, I didn't see your comment earlier!

    Unfortunately it doesn't check for terrain data yet, but that's something I want to add in version 1.5.
     
  26. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Thanks man, sorry for my negativity, my level is a bit weird for sure (was designed for fps), I just had high hopes of some kind of mini game mission featuring driving a tiny car around it. Will check out the update when it comes out, or maybe try and get some of my level to you, I could do a video if it helps.
     
  27. Tvisvarson

    Tvisvarson

    Joined:
    Mar 20, 2018
    Posts:
    4
    No problem, thanks for your Answer. If you add that, then I'm all in. ;)
     
  28. Felicityinc

    Felicityinc

    Joined:
    Nov 24, 2016
    Posts:
    24
    Hello,
    Can you add swipe controls to these physics for mobile?
    Thanks.
     
  29. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    I'm afraid touch input is outside the scope of this script. I have no plans to add it in the near future.
     
    Felicityinc likes this.
  30. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    No, there are no sound effects included in this package.
     
  31. haim96

    haim96

    Joined:
    May 24, 2013
    Posts:
    107
    Hello!
    Nice work with the controller! really good value for money. thanks!
    i have some issues i need help with.
    i tried to swap the car with models from toony vehicle set. the wheels axis of the front are different and i can get
    the direction and spinning works right. i tried to change some line of code in the controller but it doesn't help.

    also, not sure why, the wheels not always spin when i accelerate...

    any idea?

    thanks!
     
  32. Cosford5

    Cosford5

    Joined:
    Sep 5, 2020
    Posts:
    2
    Hi,
    Picked up Unity for the first time yesterday. After pouring through many YouTube tutorials regarding car driving controls, I couldn't seem to find something that felt 'good'.
    Stumbled upon this, the first paid asset I've used, and pleased to say I had a generally good experience, and works quite well.

    Two comments I have:

    (1) I found that the car body didn't want to sit at the right height when driving. The code forced it to be a fixed offset relative to the sphere Rigidbody. I added an additional public Vector3 variable to allow a 'bodyPositionOffset' to be applied:
    Code (CSharp):
    1. vehicleBody.position = car.getBodyPosition() - bodyPositionOffset;
    (2) I'd like to implement a 'boost' mechanic. This wants to apply a force to the car in the direction that the body is facing. I achieved this with a script:
    Code (CSharp):
    1. car.AddForce(carBody.TransformDirection(Vector3.forward) * boostForce);
    However, I'm finding that as soon as the boost is removed, the velocity drops back to the controller's calculated velocity. As a future improvement, can I please suggest adding a simple means to achieve this? I suspect a 'boost' function or similar would be a commonly requested feature! In the mean-time, I've set this aspect aside for now rather than making significant changes to the code base.

    Thanks
     
  33. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    I noticed the way the controller handles visuals is not great, so I'm going to change it in the next update. It should fix most of these issues and make it much easier to swap models and customize the vehicle.

    I'm also planning to add a "boost" function, seeing how it's one of the most requested feature.

    The next update is coming late October to early November, just hang tight :)
     
  34. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    Speaking of which, the 1.5 update, which I've been talking about, will come with a higher price tag. The controller will go from $9.99 to $20. This may look like a huge price hike but there's a few reasons for it;

    • It will introduce several new features, and make it easier to get up and running with your own 3d models,
    • It will finally include proper documentation, with a list of available functions, code examples, etc.,
    • I've been cruelly underselling myself and I feel this new price better represents the amount of work I've put towards this controller.
    Also, I plan to introduce a separate "pro" package of sorts, that includes a racing system and opponent AI. The planned price is $40, and will probably come around January 2021.
     
  35. Cosford5

    Cosford5

    Joined:
    Sep 5, 2020
    Posts:
    2
    Hi David,

    That's all great news. Only suggestion I'd throw in, is that as a brand new unity user, the thing that drew me to your asset here is the low price. I figured that if it did what I wanted, great and if not, well it's only $5 in the sale.

    What I might suggest is adding a demo of some description to allow people to evaluate it if possible - as a new user, this would give me the confidence needed to take a gamble on a higher price!

    Thanks again! Look forward to the update(s)!
     
    DavidJayIndie likes this.
  36. haim96

    haim96

    Joined:
    May 24, 2013
    Posts:
    107
    we
    well, i resolved my issue by separating the front wheels spin from the direction movement.
    i added another array for the front wheels axle for the direction movement.

    and yet, i'm not sure why when i accelerate the wheels spin very slow but in reverse they works fine...
     
    Last edited: Sep 29, 2020
  37. haim96

    haim96

    Joined:
    May 24, 2013
    Posts:
    107
    An idea for the next update, add support for mobile joystick control... :)
     
    tonyboutwell likes this.
  38. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    61
    Is there a way with this script to get a car to follow a moving target? There would be no user input, just an object that the car would follow.


    My other small piece of advice. In the space of 6 months you've doubled the price of this asset, and announced you're going to double it again, and double it yet again for other advanced features - that's an 8-fold price hike. Things like documentation shouldn't come at an extra cost, it should be part of the package. You are in great danger of alienating your customer base and creating a reputation that isn't a favourable one.

    Get those good reviews coming in and you'll make far more sales at a lower price than you'll ever get at the higher price. At $10 people will leave great reviews. At $20 or $40 your customers will expect a lot more and be more critical with their reviews.
     
  39. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    The $40 pack was for an entire racing game system, not the car controller alone. I don't have plans to release it anytime soon anyway. The $20 price tag would be for Tiny Car Controller, but I'm not charging more only for the additional documentation. As I said in my post above, there's going to be many more features in it that will more than enough compensate for the price. Not to mention that $5 launch price was ludicrously low, even for version 1.0.

    As for your question, for the moment you would have to write your own script to steer the car towards a target. However, this is one of the various new features that will be included in the 1.5 update.
     
  40. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    61
    Thanks for the reply.
    I Should have also added...it's a nice script ;)
     
    DavidJayIndie likes this.
  41. sabanmete

    sabanmete

    Joined:
    Mar 20, 2020
    Posts:
    19
    hi, how can i add movement controls to an ui button? i selected input type to button and try few things but cant realy make it work. i would be so happy if you can help. thanks for the great asset!
     
    Antypodish likes this.
  42. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    You can call the functions setSteering(delta) and setMotor(delta) when a ui button is down. Both functions takes values in the range -1..1 as their parameter, which correspond to left to right for steering, and reverse to forward for motor.
     
    sabanmete likes this.
  43. RenegadeNinjaNL

    RenegadeNinjaNL

    Joined:
    May 23, 2013
    Posts:
    22
    Any update on the release date for version 1.5?
     
  44. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
     
  45. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    I'll most likely have to push the date a bit, my health hasn't been great lately. But progress is being made nonetheless.
     
  46. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    In the meantime, have a little demo of two new features; turbo boost and car destruction!

     
    tonyboutwell likes this.
  47. tonyboutwell

    tonyboutwell

    Joined:
    Jun 29, 2018
    Posts:
    2
    I have bought the standard version that is out now but I would pay extra for the mobile joystick control too. :)
     
  48. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    Well, I guess I could add a simple mobile input script after all, seeing how that's the feature that I've been asked about the most. I'll look into it!
     
  49. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    Turns out I was able to do a basic mobile input UI that works fairly well with the controller. To be honest, I've been working on this for a while but I didn't want to talk about it until I knew it worked fine. I hope that's what you had in mind :p

     
    sabanmete likes this.
  50. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    I'm very happy to announce that version 1.5 of Tiny Car Controller is now live on the asset store!

    - The old "player" script has been segmented into individual components.
    - Simplified ground detection parameters (removed skin width and ground check distance).
    - Added a speed boost parameter to the controller.
    - Added a script for car destruction effects.
    - Added a script for mobile (on-screen touch) input.
    - Surface modifiers can now take multipliers that are more than one.
    - Triggers can now have surface parameters. The ground takes precedence over triggers.
    - The car visuals now leans forward when in the air.
    - Added new elements in the example scene.

    If you already bought the asset prior to this version and would like to upgrade, please make sure you have a backup first, as this version has a lot of changes that may break your code.