Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

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:
    866
    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,723
    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:
    866
    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:
    866
    I had zero Drag and Angular Drag was also low. QA team thanks :)