Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

AVC - Arcade Vehicle Controller

Discussion in 'Assets and Asset Store' started by Carwashh, Nov 22, 2019.

  1. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Arcade Vehicle Controller (AVC) is a simple vehicle controller asset allowing you to create any type of vehicle – car, hover car, motorbike, boat. The customizable arcade-y feel to the vehicles gives a fun, satisfying, player experience to your vehicles.

    Included is a Vehicle Builder editor window, which allows you to setup a new vehicle in seconds! Just link the required objects and fill in the details, press a button and you’ve got your new vehicle!

    The values for a vehicle (speed, turning, drifting, etc.) are saved in a ScriptableObject, meaning you can re-use the same values for hundreds of different vehicles, and only have to tweak them in 1 place.

    Asset Store link: https://assetstore.unity.com/packag...arcade-vehicle-controller-157860?aid=1101lGt5

    [PC DEMO][WebGL Demo]



     
    Last edited: Feb 12, 2022
    seppeq and StevenPicard like this.
  2. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    v1.5.2 - 27th June 2022
    Fixed
    - Wheels now rotate again when steering the vehicle

    --------------------
    v1.5.1 - 17th June 2022
    Added
    - Strafing now has it's own tilt value in the vehicle settings
    Updates
    - Fixed minor typo in prefab builder help
    - Removed Cinemachine namespace include that snuck into VehicleBehaviour

    --------------------
    v1.5 - 22nd May 2022
    Added
    - Vehicle audio component added. This component is used for engine start, engine running, engine stop, drifting, collisions
    - Collision effects. Easily added particle effects for collisions.
    - Collision Manager component added. This component deals with the collision events and calls its own events to pass them to the new audio and effects components (OnVehicleCollisionEnter, OnVehicleCollisionExit, OnVehicleCollisionStay)
    - Drift settings are now a ScriptableObject. These are required for Vehicle Effects (drift tire marks/ smoke) and Vehicle Audio
    - Engine can now be toggled on/off, with an option to auto start (new events added for these - OnStartEngine, OnEngineStarted)
    - Tight/ loose ground follow option

    Updates
    - Ground alignment has been greatly improved, following the contours of the ground much better than before
    - Vehicle will now rotate towards the ground as it falls through the air (optional, this can be toggled in the VehicleSettings)
    - VehicleSettings have been updated to add all the new features
    - Prefab builder tided up and new features added. UseBoxCollider is now forced to true, older setup is being phased out

    Fixed
    - Now using OnGround raycast to accelerate, instead of NearGround as this allowed the vehicle to change direction and move in the air causing weird movement. This also lead to the tight/ loose ground follow option being added
    - Setting the position when a vehicle is using the box collider setup no longer ends up in the model spinning around

    --------------------
    v1.22 - 26th April 2022
    - Fixed MaxSpeed not being reachable. MaxSpeed can now be as low as '1' and move correctly. NOTE: With this update all your current speends may need lowering by 6.
    - General code tidy
    - Added new package for Unity v2021.3

    --------------------
    v1.21 - 19th April 2022
    - Added the ability to turn the engine on/off. Auto start is on by default
    - Improved ground alignment
    - Moved some method calls out of Update() into FixedUpdate()

    --------------------
    v1.20 - 12th February 2022
    New Features
    - Added class to rotate additional wheels, allowing for more than 4 wheels
    - Added class to turn additional wheels, allowing for more than just the front two wheels to turn
    Fixes
    - Fixed bug when adding trails after builder hasn't found a wheel
    Updates
    - Additional prefab builder setting saved that previously wasn't

    --------------------
    v1.19 - 10th August 2021
    - Added CurrentSpeed property to return the current speed as a float
    - Improved slope sliding
    - Fixed vehicles using the box collider setup not sliding down slopes

    --------------------
    v1.18 - 4th August 2021
    - Added new vehicle setting 'Slide Threshold'. This allows you to tweak when a vehicle will start sliding down a slope

    --------------------
    v1.17 - 17th July 2021
    - UPDATE NOTE: This update may cause the VehicleBehaviour to lose the Rigidbody assignment. If your vehicles don't move after updating, please re-assign the vehicles Rigidbody to the VehicleBehaviour component field 'VehicleRigidbody'
    - Front wheels turn when stationary
    - Renamed property 'PhysicsSphere' to 'VehicleRigidbody'
    - Moved all create items into AVC sub-menu

    --------------------
    v1.16 - 16th May 2021
    - Added a new public jump method to VehicleBehaviour, use Jump(float) - where the float is the force to jump by
    - Added a new class 'VehicleBehaviourLinker' to make it easier to get the VehicleBehaviour - see the SphereRigidbody GameObject on the example vehicle prefabs for its use

    --------------------
    v1.15 - 1st May 2021
    - Fixed the ground check, the size of the vehicle should now no longer matter

    --------------------
    v1.14 - 16th April 2021
    - Added package for Unity v2020.3 (LTS)
    - Added touch screen controls example
    - Removed left over trigger colliders from prefabs
    - Fixed position of smoke on AI motorbike
    - No longer updating packages for 2020.1

    --------------------
    v1.13 - 13th December 2020
    - Three wheel option now available - with example
    - Turning and strafing methods now accept floats instead of ints
    - Tidied up the code a bit
    - Hidden some more console warnings

    --------------------
    v1.12 - 26th October 2020 - Info on updating to this version: https://avcdocs.enigma23.co.uk/help/updating-to-v1.12
    - Corrected use of VehicleBodyTilt settings, this value now has an affect on the vehicle tilt
    - Separated forward tilt and turn roll, allowing for rolling even with a forward tilt of 0
    - Prefab builder now assigns model parent for body tilting
    - Fixed bug with trails when swapping from 4 to 2 wheels
    - Scene is now set dirty on creation of a new vhicle via Prefab Builder
    - Undo will undo the vehicle creation

    --------------------
    v1.11.3 - 24th September 2020
    - Update Car prefab to correct rear wheel rotation
    - Code tidy

    --------------------
    v1.11.2 - 23rd September 2020
    - Fixed an error when setting the forward tilt to 0
    - Added tooltip to ForwardTilt in vehicle settings

    --------------------
    v1.11.0 - 20th September 2020
    - Forward tilt min decreased to 0
    - IsBoosting property added
    - Added angular drag to vehicle settings
    - Added new option to prefab builder, to build vehicle with box collider instead of sphere
    - Docs updated with these updates

    --------------------
    v1.10.0 - 28th July 2020
    - Added pacakge for Unity v2020.1
    - Improved example AI
    - Removed extra sphere colliders that weren't doing anything from AI

    --------------------
    v1.9 - 11th July 2020
    - Added package for Unity v2019.4
    - Added tool to fix wheel rotation when model pivot points arent centered correctly
    - Fixed SetPosition, vehicle no longer carries on moving
    - Docs moved online
    - Corrected turning whilst reversing

    --------------------
    v1.8
    - Fixed all console warnings

    --------------------
    v1.7
    - Improved ground check, allowing for the sphere collider to be resized
    - Removed unused param from VehicleEffects method
    - Stopped setup launcher opening after any package has imported, it only opens when AVC is imported
    - Improved vehicle movement to make the camera follow much smoother

    --------------------
    v1.6
    - Added setup window to make layer setup unmissable
    - Removed unused var from editor window

    --------------------
    v1.5
    - Added the option to disallow vehicles turning when stationary
    - Added a LayerMask to the grounded check
    - Fixed cinemachine target follow stutter. This happened because the target was being updated in FixedUpdate() and LateUpdate(), now everything is in FixedUpdate()

    --------------------
    v1.4 - 1st March 2020
    - Added new Vehicle Setting to stop vehicles sliding down slopes sideways. This can be toggled on/off

    --------------------
    v1.3 - 22nd Feb 2020
    - Addeed boost
    - Improved movement code

    --------------------
    v1.2 - 9th Feb 2020
    - Added support for Unity 2019.3
    - Added strafing
    - Added new vehicle example (Helicopter) to show how to use strafing
    - Added two new methods for speed penalties when changing surface Fixes/ Improvements
    - Raycast for grounded is now set dynamically, allowing for the vehicle model to be higher off the ground - Removed left over collider from all prefabs and it is no longer added when creating a new one

    --------------------
    v1.1 - 2nd Dec 2019
    - Fixed all demo scenes and prefabs.
    - Removed wrongly included items.
    - Removed post processing dependency, so it doesn't conflict with/mess up your projects post processing setup.

    --------------------
    v1.0 - 28th Nov 2019
    - First release
     
    Last edited: Jul 4, 2022
  3. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    AVC has just been approved and is now available on the Asset Store!
     
  4. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    I've just found out that all the prefabs have lost their references, so the demo scene and all the examples are currently broken - however, everything else works fine (you can create your own vehicles and drive them around instantly).

    I'll be working on getting this sorted tonight when I get home from work - if you've bought AVC and require help with this before I get the asset store updated feel free to post here/ email me : support@enigma23.co.uk

    [Edit 02/12/19: new version with all this fixed has been submitted]
     
    Last edited: Dec 2, 2019
  5. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    v1.1 is out now, which fixes all the issues from v1 - I'd suggest deleting v1 if you already have it downloaded.

    Let me know if you run into any other problems.
     
    ikemen_blueD likes this.
  6. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    239
    Hi Carwashh, I tried the demo and I really like this controller.
    I have a question, is there a drift function?
     
  7. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Hi there,

    Glad you liked it!

    The vechile settings use a ScriptableObject for the data (see attached image for an example that is included with the package), one of the settings is for drifting. It uses a normalized value, where 0 is no drifting at all and 1 is lotsa drift. You don't need to do anything special with your code to achieve drift, just tweak this value to what you're happy with.
     

    Attached Files:

    AngelBeatsZzz likes this.
  8. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    239
    Hi Carwashh, I found two problems in the demo scene.
    1, The car will fall off the bridge after starting the game.
    2, Change the "Max Speed" of "VehicleBehaviourSettings_Car" to 40, and the car will jump after going straight on the flat ground for a while.

    Does the controller have a brake function? I didn't find it.

    I tested the Drift value, it is more like changing the speed of the car turning. I think the drift should be to let the car go from one point to another, as if there is a force added to the car when turning.
     
    Last edited: Dec 15, 2019
  9. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Hiya,

    1- I'll need more info than that. If you fall through the floor, then that's a problem, but if you mean you can make it off the side ... that isn't a problem, use R to reset the vehicle position.

    2- This is 'caused by imperfections in the 3D, not the code. I'm not an artist, but I'll see if I can fix the stitching - thanks.

    3- The docs and ExampleInput.cs both show how to break, there is a ControlBrake() method.
     
    AngelBeatsZzz likes this.
  10. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    239
    Thanks for the reply.

    I use 'Unity 2019.3.0b12' + 'AVC 1.1'. After opening the 'VehicleControllerSampleScene' scene and starting the game, all cars will drop off the bridge. I think this may be a problem with the bridge collider, which is not a problem for me, but I think you may want to know this.
     
  11. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Thanks for the further info, I'm waiting until 2019.3 is actually released before I support it. Until then, it's as easy as throwing a mesh collider on the gameobject in the scene.
     
    AngelBeatsZzz likes this.
  12. HelloNan

    HelloNan

    Joined:
    Aug 10, 2012
    Posts:
    18
    Does use unity wheel collider?
     
  13. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    No. I've always had difficulty with the wheel colliders, could never get them working easily or giving the feel that I was happy with, so with this asset I stayed away from them and tried to make setting up of a vehicle extremely easy/ plug and play.

    Currently the wheels don't interact with the environment, but I'm working on this for an update.
     
  14. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Hi, can you provide a WebGL demo ?
     
  15. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
  16. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,134
    Looks a lot like Kenny's vehicle controller with similar issues - car does not hold position on a slope (even when sideways) and a lot of sideways slide by default. There is certainly a place for the right arcade vehicle controller though...
     
    Carwashh likes this.
  17. adampound

    adampound

    Joined:
    Jul 14, 2014
    Posts:
    28
    Can the vehicle flip when in air?
     
  18. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    AVC has been updated, the demos have also been updated with the Helicopter example.

    v1.2
    - Added support for Unity 2019.3
    - Added strafing
    - Added new vehicle example (Helicopter) to show how to use strafing
    - Added two new methods for speed penalties when changing surface Fixes/ Improvements
    - Raycast for grounded is now set dynamically, allowing for the vehicle model to be higher off the ground - Removed left over collider from all prefabs and it is no longer added when creating a new one
     
  19. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Sorry for the slow reply, I didn't get any notifications about these two posts.

    I haven't been able to flip a vehicle.

    I'll try and look into this, see if I can sort it out.
     
  20. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Update v1.3 is out now

    v1.3
    - Addeed boost
    - Improved movement code
     
  21. DavidSWu

    DavidSWu

    Joined:
    Jun 20, 2016
    Posts:
    183
    Very nice!
    Have you tried implementing touchscreen control inputs for mobile or tablets?
     
  22. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    I have not, but the input method doesn't matter, just call the Accellerate method from your input class.
     
  23. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    v1.4
    - Added new Vehicle Setting to stop vehicles sliding down slopes sideways. This can be toggled on/off

     
  24. Dima_Timofeenko

    Dima_Timofeenko

    Joined:
    Aug 4, 2015
    Posts:
    2
    Hello. Thank you for asset, its very cool. I found little visual bug which appears on the mobile phone. Often car twitches at speed, is trying to roll over. I fixed that. I think raycast "NearGround" hit to self collider. I added layer mask, and move this code to LateUpdate. Im not debug raycast hit on mobile, just did it and this fixed problem.
     
    Carwashh likes this.
  25. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    AVC has been updated to v1.5, if you're seeing your vehicle move incredibly slowly/ not at all you'll need to setup the layers for the ground as required - check the documentation or fire me an email.

    Update notes:

    v1.5
    - Added the option to disallow vehicles turning when stationary
    - Added a LayerMask to the grounded check (thank you @Dima_Timofeenko )
    - Fixed cinemachine target follow stutter. This happened because the target was being updated in FixedUpdate() and LateUpdate(), now everything is in FixedUpdate()
     
  26. 3CHO12

    3CHO12

    Joined:
    Apr 4, 2015
    Posts:
    18
    Looks cool. Is there any audio option coming?
     
  27. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    I made AVC to use in my own racing game, so I will be doing engine audio, but it is probably a few months away yet. At the moment I'm hoping to do it in such a way that AVC isn't required and can take in any input for a good engine sound, if this happens it'll be sold as a separate asset - however, these are not concrete plans as I haven't started development/ planning on this part yet.
     
    3CHO12 likes this.
  28. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    I've updated to v1.6, now, after importing a new window will be displayed to help setting up the ground layer, this makes it simple and obvious that this step is required.

    Information on how to do this step manually is available in the documentation, on page 3.

    v1.6
    - Added setup window to make layer setup unmissable
    - Removed unused var from editor window

    upload_2020-4-20_10-45-13.png
     
  29. wulcat

    wulcat

    Joined:
    Aug 19, 2019
    Posts:
    5
    Hey, there's an issue where the vehicle (all (easy to see on Car and Boat)) jitters while drifting round and round. Thought It was cinemachine so I tried out different camera controller and simple camera follow as well. It can be viewed on your WebGL build as well

    To Reproduce:
    1. Cap the FPS to 30-60 (mobile).
    2. Change the view of the camera (2nd mode provided by you)
    3. Keep Drifting (Left/Right arrow + Forward)/(A/D+W)
     
  30. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    What version of AVC are you using?

    It'll be happening in the WebGL version because of cinemachine, I don't update the demos for every version and the current demo versions are from before I improved the stuttery camera movement (or so I thought..)
     
  31. wulcat

    wulcat

    Joined:
    Aug 19, 2019
    Posts:
    5
    The latest one 1.6
     
  32. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    I've improved it, you no longer see the vehicle stutter, however, the skid marks disappearing is the only bit I can notice stuttering now. Need to take some time to look at this, not sure how to sort this bit out.

    https://gyazo.com/a51851f3cbaa65747241e276c1b179a1
     
    wulcat likes this.
  33. wulcat

    wulcat

    Joined:
    Aug 19, 2019
    Posts:
    5
    Thanks a lot, but I still cant @Carwashh see updated version on store
     
  34. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    I haven’t pushed the updates yet, I still need to double check everything is ok before I do.

    It usually takes Unity ~24hrs to approve it too, it’s also weekend, so (I believe) they don’t do reviews.
     
    wulcat likes this.
  35. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    v.17 is now live, changelog below. I'll get around to updating the demos on itch.io ASAP.

    v1.7
    - Improved ground check, allowing for the sphere collider to be resized
    - Removed unused param from VehicleEffects method
    - Stopped setup launcher opening after any package has imported, it only opens when AVC is imported
    - Improved vehicle movement to make the camera follow much smoother
     
  36. wulcat

    wulcat

    Joined:
    Aug 19, 2019
    Posts:
    5
    4 functions in the fixed update from update thanks a lot!!! :p fixes the jittery issue
     
  37. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Another update is now live, there were a few warnings in the console (mostly from the Example classes) because the variables are assigned in the inspector, these are now hidden. There should be no console warnings from AVC.

    v1.8
    - Fixed all console warnings
     
  38. Elharter

    Elharter

    Joined:
    Sep 20, 2015
    Posts:
    58
    Hey,
    there is no possibility (WebGL) or Videos to check out the car behaviour @ little jumps, ramps and something.....i would like to see how the physics are working if the car isnt jumping straight over a ramp for example.

    Small jump, big jump, jump while driving a small turn at the end of ramp, landing behaviour,etc.
    And especially a 90degress ramp/jump is very very interesting to see if the car jumps in the air and comes exactly back to the ramp.
    Could you provide a example-video like this - or impliment objects in the demo?

    Did you realized the physics with 1 sphere collider in the middle?

    btw: great work!
     
  39. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    v1.9
    - Added package for Unity v2019.4
    - Added tool to fix wheel rotation when model pivot points arent centered correctly
    - Fixed SetPosition, vehicle no longer carries on moving
    - Docs moved online
    - Corrected turning whilst reversing




    ----
    (The above post went to DM's and we talked about his questions there)
     
    Lars-Steenhoff likes this.
  40. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Minor update released today to improve the example AI (note: this example AI isn't intended for use in a full project)

    v1.10.0
    - Added pacakge for Unity v2020.1
    - Improved example AI
    - Removed extra sphere colliders that weren't doing anything from AI
     
  41. neoberg

    neoberg

    Joined:
    Dec 16, 2015
    Posts:
    1
    Hello,
    Is there an easy way to disable reversing?
     
  42. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Yes, if you're using the example input script that comes with AVC, just change the reverse button to 'none'. If you're creating you're own input class, just don't have a method that calls reverse on the AVC VehicleBehaviour.
     
  43. davedev

    davedev

    Joined:
    Jan 12, 2009
    Posts:
    70
    I really like this asset. I did have it up and running in minutes.

    My "vehicle" is big and slow and should have absolutely no tilt when moving. Setting "Forward Tilt" to 10 seems to successfully kill the forward/back tilt. However, when I cannot eliminate left/right tilt when turning when I change "Vehicle Body Tilt". I've tried values of 0, 3, and values in between. The vehicle always tilts to right or left when I start a turn. Decreasing steering and drift minimizes the tilt but there's always a small amount. Can I modify so I can realistically represent a heavy, slow moving vehicle?
     
  44. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    In VehicleBehavoiur.cs, comment out VehicleTilt(); on line 162.
     
  45. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Can you add an option for a hand brake please? like in a rally car for example, that will allow for more drift more when pressing the handbrake button
     
    Last edited: Sep 10, 2020
  46. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    I would like to disable forward tilt, the minimum seems to be 1, thanks!


    And on collision I would like to use a particle effect, perhaps you can add collision events to play a particle and a sound effect.
     
  47. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    I'm not sure how differently that would work with AVC (than the break currently), but I'll have a look and see if it's worth doing

    You're the second person in the past 2 weeks to ask this, I can't recall if there was a technical reason for setting the minimum to 1, but I'll look into it and change to 0 if nothing breaks. Until then, if you want to change this yourself in VehicleBehaviourSettings.cs just change the value to 0.

    This feature is beyond the scope of AVC, the collider is a sphere, so collisions won't happen exactly around the body.
     
  48. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Thanks I set it to zero and everything is still working fine :)
     
    Carwashh likes this.
  49. MRBAEK

    MRBAEK

    Joined:
    Sep 30, 2014
    Posts:
    13
    how to car make bigger?

    please see this screenshot
    car.jpg

    if i building a car to match your car's size, it works fine.

    but if i make car with original size, sphere collider is too small then car.

    is there a way of solution for this problem?

    or need i make a track or environment modify size to your car size?

    best regards.
     
    Lars-Steenhoff likes this.
  50. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    @MRBAEK Import this package, it has an example of how to manually stup your vehicle with a box collider
     

    Attached Files: