Search Unity

Vehicle can't drag the Trailer on Start.

Discussion in 'Physics' started by Domvel, Oct 18, 2018.

  1. Domvel

    Domvel

    Joined:
    Sep 18, 2018
    Posts:
    24
    Hi there,
    I have some problems with a trailer on a vehicle.

    Scene setup:
    A vehicle (standard assets vehicle prefab) and a trailer with two wheels simple wheel collider setup.

    On game start the vehicle can't drag the trailer. It looks like the trailer weights infinity kilograms.
    BUT if I move the tractor a bit in the scene editor while the game is running, it works. The car needs a little push. The direction does not matter. Also also works if I set motorTorque of the trailer wheels in Start() method to 0.001f and on update back to 0. Otherwise the trailer behaves like a heavy stone. But only at start. If the vehicle is slightly moved at start the trailer behaves like expected.

    Please see the gif videos I attached.
    The first gif (trailer-issue-1) shows the tractor with a trailer without motorTorque, I only drag the tractor a bit in scene editor. The seconds gif (trailer-issue-2) shoes the source code of the trailer I added for this example.

    The mass of the tractor is 3000 and of the trailer 1000. Connected from trailer with a configurable joint. Locked x,y,z (position) and limited angluar. I already played a bit with some values. Nothing helped.

    Conclusion: I have to move the trailer a little bit (direct or indirect) to let the tractor drive.

    I would like to be grateful for any advice or example. Is there a example of such a scene? A trailer without motor.

    Update:
    If I stop the vehicle and start again, the trailer does not want to move again.
     

    Attached Files:

    Last edited: Oct 18, 2018
  2. Domvel

    Domvel

    Joined:
    Sep 18, 2018
    Posts:
    24
    A workaround is to set motorTorque to e.g. 0.0000001f in Update() method. But the wheels meshes are jittering. I don't know, maybe there is a physics sleep feature what the problem is?