Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Wheel collider sinking in the ground problem

Discussion in 'Physics' started by bobi_z_nairobi, Jun 13, 2018.

  1. bobi_z_nairobi

    bobi_z_nairobi

    Joined:
    Jul 18, 2017
    Posts:
    5
    Hi there!
    I have a serious problem with my game. I am writing a trials remake and everything works fine, except for the wheelcollider. It behaves fine, when I ride on flat surface. When I fall and land not parallel to the ground, the wheelcollider sinks in the ground, then it bounces my motorbike away. I also tried to add extra sphere colider to prevent from sinking in the ground, increasing fixed timestep, but nothing helped.

    I dont event have to go very fast to make this happen.
    Please, help!



    upload_2018-6-13_17-22-25.png
     
  2. NDSno1

    NDSno1

    Joined:
    Dec 20, 2014
    Posts:
    185
    Hello.
    From what I've seen , the problem is in the way Wheelcollider works, or rather essentially what it is, is not a wheel but only a raycast down to detect ground and simulate suspension spring effect. So when it's on flat ground, everything is fine because the ray goes down perpendicularly with the ground. But when the ray and the ground are not perpendicular, the above happens.
    I have been only using wheelcollider for cars with fairly low normal angle, so I'm afraid I don't know the best solution.
    One thing I can suggest is to have a script that rotates the WheelCollider according to the relative angle between the bike heading and the ground.
     
  3. bobi_z_nairobi

    bobi_z_nairobi

    Joined:
    Jul 18, 2017
    Posts:
    5
    That could work, but there is just one problem, the wheelcollider cant be rotated. It looks like it raytraces -y in world space.