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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Wheel Collider limitations? [Pictures]

Discussion in 'Physics' started by HAlbera, Mar 30, 2016.

  1. HAlbera

    HAlbera

    Joined:
    Jun 7, 2013
    Posts:
    63
    Okay so I just tried out the wheel colliders for the first time.



    Now I know they raycast downwards, resulting in a 'popping up' effect on steps etc. I know they apply force at the bottom and aren't calculated in the same way as the rest of the physics.

    However is there a way to solve this, or would a better solution to be to basically use the normal physics system with a cylinder and phys material?

    I ask because I enjoy offroading myself and thought I would see if I could recreate it. Obviously for a standard racing game these colliders would work, but it just doesn't sit right with me for an offroady type game.

    Example below is where the force should be applied.



    Now I tried adding a collider to the car object, simulating the wheel basically 'being in the way' and pushing the body of the car up, but that doesn't solve the problem of where the force is applied.

    Any insights would be great?

    I'm guessing like I said, the best solution would be to use the standard physics system?

    Cheers!

    Halbera
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,430
    At this time, yes, you'd better use the standard physics system. The WhellCollider component won't resolve that situation, and it's unlikely that it will do so in the foreseen future. The design of the wheel in PhysX is entirely raycast-based.
     
    HAlbera likes this.
  3. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    381
    This has also been my big problem

     
  4. HAlbera

    HAlbera

    Joined:
    Jun 7, 2013
    Posts:
    63
    Well I've gone ahead and used them anyway, despite the stark limitations of them.

    Now I'm at a ridiculous impass.

    For my game I'm simulating the engine, gearbox and axles of a vehicle. Fine, the values used are not even close to being realistic, that's okay, I can work with that.

    The real issue is that I can't seem to access any data about the state of the torque or colliders at all!

    For example, I would like to be able to read the 'resistance' of the wheels. If a vehicle is travelling uphill the load is increased. Because I simulate the engine RPM and torque I need to be able to know how much of that torque is effectivly being wasted/ reflected.

    Currently I'm having to work out some really hacky way of using rigidbody.velocity.magnitude and manually putting in speed points in a list and checking it per gear. Another solution I considered was checking the rotation and vector of the vechicle and applying a sliding modifier to the engine RPM variable.

    Neither solution is ideal, especially since the simplest solution would be to have some kind of 'resistance' read only variable on the wheels themselves, seeing as I'm using a very low slip (high traction) profile.

    Also, the wheelcollider.rpm variable is laughable. It jumps all over the place from positive to negative and back again in a second. I considered using a list to store the last half a second of rpm readouts and averaging them. But again, a really hacky solution.

    Thanks for the replies guys!

    Halbera