Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Scripting Rigidbody.MovePosition collision never ends

Discussion in '5.4 Beta' started by TheOtherMonarch, Jun 15, 2016.

  1. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    901
    I have developed a vehicle physics system that does not use wheel colliders. I had hoped to use Unitys collision response PhysX code to handle collision response.

    However, Rigidbody.MovePosition seems to have many problems when colliders collide. Causing all kinds of weird translations and rotations to arise. These forces never go away causing the vehicle to permanently go out of control.

    I uploaded an extremely simplified example project (case 805856_6jr55d62nj65t8mq)

    This bug is present on 5.3 as well.
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,725
    MovePosition is an interpolated non physical teleport. Why would you expect correct response from it? You are forcing it to a new position and telling Unity to update the transform with interpolation setting.

    You have to use AddForce or just set velocity manually, this will do the same thing as MovePosition but it will properly simulate and adjust the velocity after doing so.
     
  3. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    901
    I don't care about correct. I care that it makes the unit spin like a top forever after collision and bounce off forever. I don't want penetration the bouncing off is ok but not forever.

    Add force is not going to work well for ray casting best fit wheel plane fitting I use for suspension and ground clamping.

    I turn gravity off so the collider floats above the ground and it supported by ray casting plane fitting for ground clamping and gravity.

    Its the forever and ever part that is bad.
     
    Last edited: Jun 15, 2016
  4. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    901
    I had zero Drag and Angular Drag was also low. QA team thanks :)