Search Unity

  1. Unity 2019.4 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  3. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Wheel collider problem when wheeling a bike.

Discussion in 'Physics' started by vagelis199, Aug 22, 2019.

  1. vagelis199

    vagelis199

    Joined:
    Jul 27, 2012
    Posts:
    50
    Been struggling with this problem long time now using rn (unity 2018-2.5f1) but basicly when a motorbike (Rigidbody) rotates in its x axis (does a Wheelie or stoppie) the wheel colider pivot or ground point rotates with it making it imposible to wheelie or do a stopie without start bugging, i understand that this way its possible to ride slops and etc but its not ideal for a motorbike doing a wheelie, does anybody found a solution or knows how to help ? would be appreciated Heres an image https://ibb.co/qCFdvZr , Theres no possible way to make the wheels always look down no mater the roots rotation :|
     
  2. radialxawn

    radialxawn

    Joined:
    May 13, 2019
    Posts:
    29
    The wheel collider only have one raycast down so you cant do a wheelie, i think you should use a multi raycast wheel method from asset store or make one your self.
     
  3. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,781
    You may use a separate rigidbody for the front part of the bike, attached to the main body via joint. Then you could adjust the angle of this rigidbody and the WheelCollider would follow that rotation.
     
    devotid likes this.
  4. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    417
    Im working on this exact thing right now Ed and he is right.... the Wheel collider always follows its original mounted angle. Im trying to make the rear wheel always point 0,-1,0 and follow the ground (To ride a rear wheelie) as the front end comes up. It seems though... the rear wheel collider will rotate with the frame and then the rear of the bike sinks into the ground as the single raycast is at too far of an angle to get a hit. This creates a bouncy effect on the rear tire as the raycast gets a hit and then doesnt....

    I just tried your hinge method and I could not get the suspension to act normal..... as the hinge limits the suspension travel of the wheel collider. You are right though (and a major Eureeka moment for me.) that putting the wheel collider on a hinge does work.... but I would have to redo the whole suspension/Animation model.

    I am going to dink around with it more and will report what I find. ;)
     
    Edy likes this.
  5. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    417
    This is what I ended up with... I still have some work to do but I think its a decent base to build on. I just needed another way to traverse around the island and a bike worked out pretty good. Its really fun to just cruise around.

    I ended up not putting too much torque on the main body when leaning forward or backward. That stops the loop outs and wheel colliders acting funny when trying stoppies or wheelies. This is not a bike sim and only using it for simple transportation.

     
    Edy likes this.
  6. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,781
    Good work!
     
unityunity