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. MRBAEK

    MRBAEK

    Joined:
    Sep 30, 2014
    Posts:
    13
    thanks, it works
     
    Carwashh likes this.
  2. BKGcode

    BKGcode

    Joined:
    Feb 10, 2017
    Posts:
    3
    Hi, I just purchased AVC and I'm messing around.
    I tried this RigiBody thing but I can't scale the car properly.
    Can you explain a bit more how can we scale the vehicles?
    Also, is there any plan or trick to improve gravity?
    Thanks,
     
  3. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Could you email me (support[at]enigma23.co.uk) explaining what you're having trouble with, including any relevant screenshots? Include the vehicle you're using too if you can - I'll be able to test properly and do step by step guide for you if required.

    No changes to gravity is planned. There is a gravity setting in the VehicleSettings that you can tweak to your pleasing.
     
    BKGcode likes this.
  4. Jiinzu

    Jiinzu

    Joined:
    Jan 18, 2019
    Posts:
    12
    i i follow the tutoriel set a car and my car is very slow how can i fixe this ?
     
  5. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    We dealt with this via Twitter, but for anyone else that may come across this issue.

    Why is my vehicle moving very slowly or not at all? (link)
    As of v1.5 AVC requires a LayerMask to be set for the ground, by default this should be set to “Default”. On your vehicle settings check what the ‘Ground Mask’ is set as and correct this to what your ground layer is set as.

    Layer setup: https://avcdocs.enigma23.co.uk/getting-started/layer-setup
    Vehicle Settings: https://avcdocs.enigma23.co.uk/vehicles/vehicle-settings
     
  6. Carwashh

    Carwashh

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

    - 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
     
    Lars-Steenhoff likes this.
  7. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Hi, I'm having an issue with 1.11.0

    When I set the forward tilt to 0 in VehicleBehaviourSettings_Car the following error comes up when I press play.

    Screenshot 2020-09-23 at 20.00.53.png
     
  8. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Well, S***. Not sure how I messed that push up. Fixed and will submit now, but until then you can add

    Code (CSharp):
    1. if (ForwardTilt == 0) { return; }
    on line 248 in VehicleBehaviour.cs

    Sorry everyone!
     
    Lars-Steenhoff likes this.
  9. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Thanks for the fix, I did replace the whole line 248

    And took out
    Is that correct?
     
  10. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    No, you need to put it before that line

    Code (CSharp):
    1. private void WheelAndBodyTilt()
    2.         {
    3.             if (wheelFrontLeftParent != null) { wheelFrontLeftParent.localRotation = Quaternion.Euler(wheelFrontLeftParent.localRotation.x, RotateTarget / 2, 0); }
    4.             if (wheelFrontRightParent != null) { wheelFrontRightParent.localRotation = Quaternion.Euler(wheelFrontRightParent.localRotation.x, RotateTarget / 2, 0); }
    5.  
    6.             if (ForwardTilt == 0) { return; }
    7.             vehicleBody.localRotation = Quaternion.Slerp(vehicleBody.localRotation, Quaternion.Euler(new Vector3(speedTarget / ForwardTilt, 0, RotateTarget / 6)), Time.deltaTime * 4f);
    8.         }
     
    Lars-Steenhoff likes this.
  11. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Thanks it works fine now.

    One other question the cars back wheels are rotating in the opposite direction of the front wheels, how can I make them both rotate the same way?
     
  12. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Are you using the demo car? Or your own?
     
  13. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Demo car, I will replace it with my own.

    I fixed it with the model, flipped the wheels
     
    Last edited: Sep 23, 2020
  14. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    The code is fine, it's the rotations on the GameObjects for the rear wheels setup incorrectly. Thanks for pointing it out, I've already sorted it - it will be available in v1.11.3
     
    Lars-Steenhoff likes this.
  15. Shill1985

    Shill1985

    Joined:
    Jun 11, 2014
    Posts:
    1
    Hi, I'm wondering how you would go about allowing the car to go on upside down loops?

    Thanks for making the controller!
     
  16. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Hmmm... quick answer is: I don't know, never played around with things like that before. I'll have a look into it, but I'm pretty stacked atm, so it may be quite some time before I can get around to it - sorry.

    You're welcome, glad you like it!
     
  17. 3CHO12

    3CHO12

    Joined:
    Apr 4, 2015
    Posts:
    18
    How do I make Helicopter fly OVER things? The sphere collider moves along ground and collides all objects. Is there a way to collide with side of a building but also rise higher and fly over it?
     
  18. hvillacruz

    hvillacruz

    Joined:
    Aug 15, 2018
    Posts:
    8
    can i use my own prefab cars to control?
     
  19. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
  20. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    You'll need to make the chopper with the "Use Box Collider" option in the prefab builder: https://avcdocs.enigma23.co.uk/vehicles/building-your-vehicle

    And then create 2 layers:
    - VehicleMovement
    - VehicleCollision

    In Project Settings -> Physics -> Collision matrix, stop VehicleMovement colliding with 'default' and 'VehicleCollision' ( AVC_PhysicsCollisions.png ).
    Set the box collider GameObject layer to VehicleCollision ( AVC_BoxColliderLayer.png ).
    Set the sphere collider GameObject layer to VehicleMovement ( AVC_SphereCollider.png ).

    Example of it working:
    https://gyazo.com/256bce7e62336c6e126c6cfab1a7138f
     
  21. 3CHO12

    3CHO12

    Joined:
    Apr 4, 2015
    Posts:
    18
    SUCCESS!!!!!!!!!!! THANK YOU!
     
    Carwashh likes this.
  22. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    v1.12 will be going live tomorrow (Mon 26th Oct) and comes with a change that will (probably) affect any vehicles made with previous versions of AVC. An explanation to the issue, and the fix, can be found in the docs here: https://avcdocs.enigma23.co.uk/help/updating-to-v1.12

    Over the course of the past year, I've done the occasional additional script to help a dev (who's using AVC) work out how to do <something> with AVC. I'm starting to add these to Github Gist and share them on the docs, as they could be useful for others. These are shared as examples only, for guidance and do not come with any support - they are not of production quality.

    The first gist I've shared is an example of how to use AVC with Unity's new InputSystem:
    https://avcdocs.enigma23.co.uk/github-gists


    ---------------------------------
    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
     
    Last edited: Oct 25, 2020
    Lars-Steenhoff likes this.
  23. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Thanks for the updates!
    love this one "Separated forward tilt and turn roll, allowing for rolling even with a forward tilt of 0"
     
    Carwashh likes this.
  24. MRBAEK

    MRBAEK

    Joined:
    Sep 30, 2014
    Posts:
    13
    hello, i try to make ai car with your ExampleAIMovement.cs

    making a car with Vehicle Prefab Builder, and add ExampleAIMovement then setup the waypoints.

    but, if i enter play mode, my ai car's steering so weird.

    it seems to be try to match the direction precise target waypoint.(0:32)

    please, see this video.



    my car size little bit bigger than avc's sample car.

    1.jpg

    how can i fix this situation?

    is there any solution?

    best regards.
     
  25. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    @MRBAEK - hmmm, the size of the model shouldn't make a difference to the movement.

    I'd just like to make clear, that the AI is just an example, and perhaps not of production quality. However, I'd expect it to give the same results for your model, as you see with mine.

    Could you email me some screenshots of your AI vehicle hierarchy? And, if possible, the fbx for the model? I've not encountered this issue before and will need to investigate - email: support [ at ] enigma23.co.uk
     
  26. MRBAEK

    MRBAEK

    Joined:
    Sep 30, 2014
    Posts:
    13
    hello, i try to make infinite race game.

    but, if road tiles place to exactly matched position, there is a phenomenon in which the vehicle jumps at the point where the tiles are connected.

    please see these screenshots and video:
    01.jpg 02.jpg


    vehicle prefab are used by 'e23/ArcadeVehicleController/Examples/VehiclePrefabs/Car' and no modification.

    i also try to change rigidbody's mass, set physics material with all value to zero and create vehicle prefab with boxcollider(using your prefab builder wizard), but it's not work.

    can i fix this situation?

    best regards.
     
    Carwashh likes this.
  27. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
  28. modernator24

    modernator24

    Joined:
    Apr 7, 2017
    Posts:
    168
    Hey, I have some questions about this asset.
    1. Does this also work with cars with more than 4 wheels?
    2. And what about half-track?
    3. Is this mobile friendly?

    Thanks.
     
  29. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Hey, hey,

    1- Currently no wheels, 2 wheels and 4 wheels. I should update AVC to support 3 wheels and spinning for >4.
    2- Not sure exactly what you mean by half track.
    3- Yes, AVC is platform/input agnostic - there's an example class on Github gist of how to use touchscreen input with AVC: https://gist.github.com/Carwashh/aa138e2487d7324407b7ff603996577f
     
  30. modernator24

    modernator24

    Joined:
    Apr 7, 2017
    Posts:
    168
    This is a half-track vehicle:

     
  31. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    @modernator24 ah, I see. No, AVC doesn't have in-built support for tracks
     
  32. modernator24

    modernator24

    Joined:
    Apr 7, 2017
    Posts:
    168
    Yeah, the first time I saw this, it was really cool and I'd gladly want to buy it, but I checked your other videos and noticed that only limited types of vehicles can be done. Probably most racing games are fine with 4 wheels, but it would be awesome if the system is more flexible. Any thanks for the reply!
     
  33. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Is there a way to map the analog joystick input to the controller? I see only digital inputs in the list.
    Thanks
     
  34. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    I don't have my controller to test with, but if you change the int to a float for the param.. it'll still turn, see if that gives you the input that you're after.

    So from this:
    Code (csharp):
    1. public void ControlTurning(int direction)
    to this:
    Code (csharp):
    1. public void ControlTurning(float direction)
     
    Lars-Steenhoff likes this.
  35. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    New update. I've added a 3 wheel option and made the turning/ strafing accept floats instead of ints.

    https://twitter.com/en9g131/status/1338469099744190465

    note: if you're getting a null reference error because of the wheels now, check that the VehicleType is set correctly on your vehicles VehicleBehaviour.

    ---------------------------------
    v1.13
    - Threewheel 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
     
    Last edited: Dec 14, 2020
    Lars-Steenhoff likes this.
  36. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Thanks for the update!
     
    Carwashh likes this.
  37. jedai747

    jedai747

    Joined:
    Oct 31, 2018
    Posts:
    77
    Hello, asset is mobile friendly?
    is it possible to waypoint movement?
     
    Last edited: Dec 16, 2020
  38. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Yep, you can find an example of touchscreen input in the online docs : Github Gists - ArcadeVehicleController (enigma23.co.uk)

    Example AI which follow a waypath made of waypoints is included in the package. The above link also has an example class to work with the NavMesh.
     
    jedai747 likes this.
  39. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    I would like the car rotation to align to the road surface , is there a way to do that?
    My car when going in a curved corner stays horizontal

    ( sloped road )
     
  40. jedai747

    jedai747

    Joined:
    Oct 31, 2018
    Posts:
    77
    i use motorbike ai from demo scene and bike are shaking. Can you help with that?
     
    Last edited: Dec 16, 2020
  41. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    I need more details than this... please send an email to support [at] enigma23.co.uk with the details so I can sort it out for you.
     
  42. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    It should already be aligning to the surface. Make sure the ground is set to the correct layer - if that doesn't sort it, throw me an email with screenshots, and if you can the fbx for the slope.
     
    Lars-Steenhoff likes this.
  43. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    It was user error, I have it fixed now, thanks for confirming that it should work.
     
    Carwashh likes this.
  44. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Hi @Carwashh,
    I have a question: Is there a way to limit the distance the car can jump in height?
    There are times when the car collides with an object and send the car flying higher than I would want.
    I want to make a maximum distance limit from the ground if that's possible?

    ( even happens with the changed physics settings value set to 0.0001. )
     
    Last edited: Jan 9, 2021
  45. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Open Scripts/VehicleBehaviourSettings.cs and change the range for Gravity to allow for a higher value. Then play around with that setting and see if you can get a feel that you're happy with.

    AFAIK this will only stop the vehicle jumping in the air at the joint of two colliders.
     
  46. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    At what line should I try changing the gravity?
    I see the there are many places in that script
    thanks!
     
  47. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Line 16, change the [Range(0.0f, 20.0f)] ... change 20 to whatever max you want it to have.
     
    Lars-Steenhoff likes this.
  48. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,451
    Thanks, I also reduced the bounciness on the car material and my wall material, seems to help.
    In the end I will change my wall colliders to tilt outward to make sure the car does not bounce off when colliding with the wall.
     
  49. koraybirand

    koraybirand

    Joined:
    Dec 4, 2020
    Posts:
    11
    Hi,

    First of all thank you for such a great asset. I have a small problem regarding jitter.
    I am using Pro camera form my follow. Everything works fine until the player steps into his motorbike.
    There is extreme jitter. Procamera is set to lateupdate . Although I tried fixedUpdate, same problem.



    Any ideas ?

    Thanks
     
  50. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    746
    Whenever I get this issue with Cinemachine, it's because the Update methods being used on CM don't match with what my classes are using.

    CinemachineBrain has the 'Update Method' and 'Blend Update Method' exposed, allow you to select which method it should be updating various things in. I don't have ProCamera to be able to see if this is possible with that.

    https://imgur.com/a/ZrREnjP