Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Wheel Controller 3D - Customizable Three Dimensional Alternative to WheelCollider

Discussion in 'Assets and Asset Store' started by NWHCoding, Nov 17, 2016.

  1. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    Hey MHW. Thanks for the reply. I don't particularity want to set a realistic curve, if I am honest. I want to set the rear tyres to be linear and experiment from there. Is there a packejka visualiser I can use to quickly visualise the curves I make?
     
  2. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    759
    Unfortunately, no.
    You could start with the Arcade preset then - it is quite close to linear. Only the first two parameters are important (one defines the slope and other the strength of the peak, can not remember which is which tho).
     
    IceBeamGames likes this.
  3. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    Ok, thank you.
     
  4. AutoRotate

    AutoRotate

    Joined:
    Aug 1, 2014
    Posts:
    124
    Hi,

    Could you please explain how to properly implement this? I am trying to use this for a tracked vehicle.
    Code (CSharp):
    1.  
    2. WheelController.trackedVehicle
    3. WheelController.trackedOffset
    4.  
    Do I place a separate "virtual" wheel in the middle of the track, in addition to the road wheels? Or do take the radius of the virtual wheel (of the track) and spread it among all the wheels?

    Thanks!
     
    Last edited: May 16, 2019
  5. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    759
    Hello,
    both of those are intended just for internal use with NWH Vehicle Physics (which include WC3D as a wheel solution). WC3D does not support (out of the box) tracked vehicles nor does it mention them anywhere on the asset page.
    What trackedVehicle flag mostly does is disable any wheel slip (tank can not slip the wheels inside the tracks). There are some other minor changes.

    But in short you could simply apply positive torque to wheels on one side, and negative torque to wheels on the other side and you would get the tracked vehicle - minus the tracks (a bit oversimplified but it will work with correct slip settings). This is basically how tracked vehicles work in NWH Vehicle Physics:
     
    AutoRotate likes this.
  6. AutoRotate

    AutoRotate

    Joined:
    Aug 1, 2014
    Posts:
    124
    Thanks for the response, what you mentioned is what I am already doing and it is working really well. Just needed some clarification to above mentioned properties -thought maybe there's a better way to do this.

    Any near future plans for an asset that would handle just the tank tracks and wheels? I know you have a complete solution package but I don't really need the full package (engines etc..).

    P.S. Since you mentioned asset store, it actually does indicate Tanks. In fact, line below was the primary trigger for me to purchase this.

    "• Suitable for different kinds of vehicles: cars, trucks, motorcycles, tanks, etc."

    Since almost all tanks are tracked, I assumed above properties were in place to accommodate those. But no worries, I am a very satisfied customer.
     
    Last edited: May 17, 2019
  7. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    759
    Ah, that is because there was a tank in the demo in the early versions, just without the tracks. Forgot about that.
    If you send me an email w
    Ah, my bad then. The description was written about two years ago and I forgot about that one. There was a tank for a short time in the demo scene but it was trackless, and the options that you see came much later. The intention was to let customer know it can be used on a tank - but not that it has tracks built-in. Hopefully this has not confused anyone and if it has I will remove it.
     
  8. AutoRotate

    AutoRotate

    Joined:
    Aug 1, 2014
    Posts:
    124
    Not a problem, I bought this long time ago. I never expected it to be a fully tracked solution, but thought it can be extended to a tracked solution, which it has and works well for me. When I saw those property (especially the virtual radius), I thought to myself NWHCoding knows his stuff and is a genius, thought of everything! :) I got excited and I just wanted to see if there was a proper way to implement it, wasn't questioning the asset, just needed guidance. I thought instead of using 5 wheel per side, I can use 1 wheel (in terms of physics calculations, 10 wheels vs 2 is much less taxing) with a large radius using that radius offset property.
     
  9. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    Hey again NWH.

    I was wondering if I can easily adjust the length the springs extend to while keep the same rest point? I am making a rather arcady racer and want to be able to keep the wheels on the ground while bouncing around quite a lot.

    Also, is it possible to adjust how far the renderable wheels extend to separately from the actual simulated wheels? Might be useful so that they don't look so ridiculous when going over large jumps...
     
  10. AutoRotate

    AutoRotate

    Joined:
    Aug 1, 2014
    Posts:
    124

    Attached Files:

    Last edited: Jun 1, 2019
    krou likes this.
  11. nimu7410

    nimu7410

    Joined:
    May 15, 2019
    Posts:
    1
    Hey please can anyone tell me when I'm trying to add the wheel controller script in the wheels of a vehicle, wheel collider itself comes to center of the vehicle and also I'm unable to move that wheel collider.
    Please help me I'm in serious pain.
     
  12. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    40
    @NWHCoding Hello! I think I may have found a bug and would like to get your opinion.

    I have a vehicle that's working and performing great! I noticed when I pause and then unpause my game, my vehicles wheels will now jitter around endlessly. I'm pausing the game by setting the 'timescale' to '0', and then un-pause by setting the 'timescale' back to '1'. I was able to repro this issue in the Wheel Controller Demo scene. It's very subtle... but it occurs. A higher coefficient value (like Slip=2 and Force=4) better exposes the jitters. Again, these higher values work perfectly fine, up until the game is paused/un-paused... then the jitters occur.

    Is this a legit bug or should I not be pausing the game in this fashion? I'm using playmaker to set the timescales.
    Thanks for any feedback!
     
    Last edited: Jul 3, 2019
  13. Smrdis

    Smrdis

    Joined:
    Sep 19, 2016
    Posts:
    7
    Hi.

    Is it possible to use mesh collider as road? I just copypasted car from demo to my scene and car physics looks really bad. Car jumps and flies away on any bumps.
     
    Last edited: Jul 12, 2019
  14. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    759
    It certainly is. Just disable Queries Hit Backfaces in Physics settings (Project Settings > Physics) and you should be good to go. The jumps are there because raycasting an infinitely thin mesh (i.e. a plane) can sometimes result in a flipped normal if this option is enabled.
     
  15. Smrdis

    Smrdis

    Joined:
    Sep 19, 2016
    Posts:
    7
    Thanks for answer. Queries Hit Backfaces was disabled in my project by default, so it can't help. But I have tried to disable Queries Hit Triggers and currently it works well %).
     
  16. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    Hey @NWHCoding.

    Is there a function to reset all wheel forces, for instance because you are resetting the vehicle position because it fell off the track?
     
  17. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    759
    There is not yet. I am currently working on 2.0 update for NVP (which uses WC3D for wheels) and am implementing Reset() function in all of it's classes so WC3D will get one too. At the moment you can set wheelController.wheel.angularVelocity and wheelController.wheel.residualAngularVelocity to 0 and it should effectively reset it. ResidualAngularVelocity is the only value carried over from the last frame, the rest is calculated on per-frame basis (assuming I did not forget something).
     
    AutoRotate and IceBeamGames like this.
  18. VagabondOfHell

    VagabondOfHell

    Joined:
    Sep 17, 2013
    Posts:
    10
    Hi @NWHCoding

    I'm looking at some asset store utilities for wheels and came across yours. I'm looking to make some modular vehicles similar to


    Would WC3D work well in that situation (where the wheels are attached to the vehicle with fixed joints for runtime building)? And are there any restrictions with how the WC3D wheels are placed (i.e. placing them upside down on the 'roof' of the vehicle for when the vehicle flips for example)?

    Thank you!
     
  19. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    759
    Hello,
    There are two things to take into consideration when placing WC3D wheels:
    • They have to have a spring. Spring is a part of the wheel and setting spring length to 0 is not recommended since then you will get an effect more akin to a collision (impulse response) rather than smooth rolling over bumps.
    • Wheels only detect on the lower half, and only on the tire thread portion (bottom 180 degrees). This is usually not a problem since a collider can be placed to cover the top part of the wheel but in some cases you might want the wheel to work from all sides and this is not it.
    They can be placed in any position, rotation or orientation.