Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Universal Wheel Physics

Discussion in 'Assets and Asset Store' started by Roni92pl, Jul 29, 2015.

  1. Shadowmage45

    Shadowmage45

    Joined:
    Apr 28, 2016
    Posts:
    5
    Hi;
    Was interested in picking up this wheel solution (for Kerbal Space Program modding purposes), however from my brief experience with the web-player demo I'm left with one outstanding question:
    Any plans to implement static/adherent friction? Mostly I'm looking to stop the vehicle from 'sliding' down hills sideways, as the terrain in KSP is seldom flat and having vehicles sliding 'downhill' constantly is undesirable.

    Thanks in advance :)
     
  2. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    268
    Hi, thanks for interest, but there are no such plans, sorry.
     
  3. Zireael07

    Zireael07

    Joined:
    Apr 27, 2016
    Posts:
    47
    Am I doing something wrong or is the demo camera weird (looking at the car's rear right instead of straight at the rear)?
     
  4. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    268
    Yes, camera is directed to the side of car so you can see wheels movement well.
     
  5. Zireael07

    Zireael07

    Joined:
    Apr 27, 2016
    Posts:
    47
    You might want to add a second straight rear camera then. I bet it makes many people wonder what is wrong with their setup. Seeing wheel movement well is a nice goal, but seeing where your car is going is even nicer! And/or being able to switch between the two.
     
  6. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    848
    Asked months ago for some extra cameras to be added to the demo but the developer seems reluctant to add any.
     
  7. juliocdep

    juliocdep

    Joined:
    Sep 30, 2010
    Posts:
    25
    Hello,

    I'm creating a combat game where you can create a modular car/robot, the construction system is very similar with the game Besiege. Where you use blocks to make your creation. The main problem that I'm having is with the wheels blocks, until now I'm using a simple cylinder collider attached in the other block with a hinge joint. But the result is very poor, specially at high speeds.

    Is possible do that with your wheel system?
     
  8. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    381
    I have just found this asset that seems to be very good, but I have seen that the last update was in september 2015 and we are now in April 2017 and the last news from Roni here is from May 2016.

    So, I wonder if this is still compatible and usable with Unity 5.5 or the new 5.6?

    Is this abandoned and will not be updated anymore?

    As I do not want to buy something that may break in a future version or that there is no customer support

    thanks for any help
     
  9. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    268
    Hi, the asset is still fully supported, and recently checked on Unity 5.5 and everything worked perfectly, feel free to post any problem/question here or contact me via mail I usually respond in few hours.
     
    Prodigga likes this.
  10. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    5,917
    I'm not sure if this asset is still fully supported but on the off chance it is, I wonder if it'd be possible to answer a question I've been struggling with: Is there a way to improve the turning radius of 4 wheel vehicles? I've been able to cheat it a bit by making the wheels closer to the middle of the car, but this is a little hacky, it feels like.
     
  11. EndUser

    EndUser

    Joined:
    Aug 12, 2013
    Posts:
    51
    Salut!

    1)

    Can it hold 30-60 tons tank, like T-34 and Pz 6 Tiger?
    Or it will hallucinate as most PhysX wheels do? ;-)

    Is vehicle weight real or toy?

    2)

    How can I configure dynamics strategically, like
    "0-100km/h in 20 seconds",
    "100-0km/h in 10 seconds on full brakes",
    "100-0km/h in 40 seconds without brakes",
    "Climb angle 35°, sideslip andle 30°",
    "Turn rate of tank is 25° per second",
    "Brake power of engine given is 600hp and vehicle total weight is 32000kg"
    "Crossover soil halves tarmac dynamics"
    "Player just gives goal speed during the game"
    ?

    I really don't have any intention to dive into torque N∗m, springs N/m, wheel weight et tutti frutti hullabaloo. It's contra-productive.

    I already spend an entire month learning Chobi's demo to bend my own caterpillar track and I'm way too far from minimal viable product.

    Thanks for the answer!
     
    Last edited: Nov 28, 2018
  12. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    268
    Hi. It's funny you asking about supporting tanks, because I actually make game with tanks and use wheel colliders for them, so yes, their real weight, and car weight in demo is also realistic, no problems here.

    As for second question I'm afraid I cant give you any specific answer, other than trial and error method, or writing some automatization script that takes your torque values, wheel radius, overall traction and calculates those values you are interested in.
    I believe accurate numbers without actual physics simuulation done would be rather hard to achieve, luckly Unity now supports this kind of thing with separate physx scene.
     
  13. EndUser

    EndUser

    Joined:
    Aug 12, 2013
    Posts:
    51
    Excellent!
    Because if one can fake tank weight with some chance of success, I have no idea how to fake an airplane weight: entire flight dynamics would go off the rails with the fake mass.

    Most of parameters could give basic coefficients directly, as I understand:
    side-slip angle = lateral friction. For most vehicles it would give longitudinal friction as well. Only caterpillar tracks could have that anisotropic (which could be ignored at first approach).
    deceleration could give longitudinal friction as well, but for entire carriage, not just wheel-ground contact point rolling resistance.
    climb angle has two limits: either traction slippage, or engine output limit. Which one of two probably could be told by side-slip parameter, or, even better, engine-off parking on the slope. Having low-gear propulsion force, we could calculate near-zero low velocity efficiency rate and overall behaviour.
    For armoured vehicles, aerodynamics hardly adds a factor, so I may suppose that friction is constant. Right? Which can lead us to power output curve (line).
    But "strategical" approach omits gearbox switching. Which would be good for my game (tactics over mechanics), and would be harmful for other programmers (with excellence in score through excellence in mechanics type of games)... :-(

    Last two questions before I'd like to buy your library:

    1) would your wheels fit landing speeds of airplanes? I mean 250km/h. Without shimmy and other bugs which throw airplane from the runway unexpectedly. To allow airplanes to take-off as well without yawing randomly.

    2) can I skip tuning torques/brakes for your wheels, and operate the tank as integrated rigid body via "strategical" paradigm? And wheels won't have visually zero or infinite angular speed irrelevant to current voyage. Ideally, passive wheels should have tangent speed = travel speed. Will your math resist controlling tank with "external" forces of steering and pushing?
    In the worst case, I'm fine with you providing only hovering without longitudinal friction.

    Thank you!

    P.S.http://martynapaluszynska.wix.com/ is dead!
     
    Last edited: Dec 4, 2018
  14. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    268
    1. I honestly can't promise perfect behaviour because there is always too much variables with physics and if numbers are big enough there always be some weird/wrong behaviour, and not much can be done about it, real time physics simulation is always very simplistic model of real physics and is about compromises.
    But with that said I designed this wheel to be as flexible as possible so it's not strictly for cars - should be absolutely fine on planes, just taking into account mentioned limitations.

    2. Yes, you can absolutely skip torque and brakes for wheels, move rigidbody by normal physx addforce and such and should work just fine. It should be also pretty easy to completely skip/comment out frictions calculations and/or torque/brakes and would behave julst like spring with damper.
    Btw there is also rotational inertia simulated so that is something that will surely affect landing/starting plane(just like irl).
     
  15. EndUser

    EndUser

    Joined:
    Aug 12, 2013
    Posts:
    51
    Thank you!

    What's about web-demo? :)
     
  16. nuonical

    nuonical

    Joined:
    Feb 28, 2015
    Posts:
    46
    I recently purchased your asset and have been enjoying it thus far. The biggest issue I've come acrosss thus far is that the wheels must be placed with a specific down and forward direction aligned with your vehicle / rigidbody.

    For example if you wanted a wheel on your roof, you'd have to rotate the wheel so the raycast shoots up. Though if you do that then now the wheel would no longer work if it hit the ground below it.

    I've added an additional raycast to shoot up if it doesn't find one below (in CalculateSuspensionForces()), but now I have to go around and change the visual wheel display, rotation calculations ,etc. Would you be willing to update the code to accommodate "upside down" wheels and the like? I think this would make the package much more modular.
     
  17. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    268
    Hello, I don't get why you don't just rotate it so it shoots ray up?
    I mean if wheel is on roof, I guess you want it directed in up vector of vehicle anyaway.
     
  18. nuonical

    nuonical

    Joined:
    Feb 28, 2015
    Posts:
    46
    The main reason is that my players are able to snap wheels onto their vehicles, so they don't which way is up or forward on the wheel.
     
  19. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    268
    So you want wheel that works for both ways, up, and down am I right? Sounds like rather unusual usecase.
    Doing it in library would have performance implications, I suggest you just duplicate it and rotate one of them 180 degree on x or z axis and eventually reverse direction input, depending on how you expect steering in such scenario to work.
     
  20. nuonical

    nuonical

    Joined:
    Feb 28, 2015
    Posts:
    46
    Correct, I think the wheels could check up or down, or perhaps be configurable. I've modified the library to allow you to choose which directions to raycast - up, down, left, right. For my case up / down is enough to allow wheels to feel more like 360 degrees. In the screenshot below up / down raycasts allow the wheels to continue working even if the vehicle flipped upside down :
    wheels.png

    For performance I only raycast upwards if we didn't find anything raycasting down. I also first raycast in the direction of whatever was hit last, so there isn't any additional overhead if you are grounded, and only a single additional check if you are not. That seems reasonable to me performance wise. And if you don't need the additional checks you can just keep it to raycasting down.

    I've also changed the forward direction to be taken from the parent rigidbody, instead of the wheel, which I could see as potentially being situational. But it would be pretty cool to be able to put wheels perpendicular to a vehicle :
    wheels-side.png

    I'm not sure what the physics would do if all of those wheels are touching, but I will keep playing with it.

    All in all I've been having fun playing with it, and with some modifications I think there are some really interesting possibilities here.
     
  21. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    268
    Yup, thats usecase is definitely out of UWP scope. But Im glad you managed to expand it to do stuff I never planned for ;)
    You can already do that. But I guess you meant situation with your modified wheel collider.