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.

rigidbody usegravity broken?

Discussion in 'Physics' started by frostymm, Dec 5, 2014.

  1. frostymm

    frostymm

    Joined:
    Jun 21, 2013
    Posts:
    34
    So I needed to make a jumping target box.
    I put a rigidbody on it, set usegravity to true, set the boxcollider to trigger so that it would function properly with all the code I've already got for stationary targets.
    Because I set the collider to trigger, I had to detect the ground collisions myself. So I made a script that whenever the box touched the ground, usegravity would turn off.

    My problem is that even though the rigidbody turns off, the box continues to fall.
    I've checked that my code is being run, it is. And when I select the target box in the editor I can even see the checkbox on "Use Gravity" become empty as it continues to fall. Is anybody else having this problem?
     
  2. Habitablaba

    Habitablaba

    Joined:
    Aug 5, 2013
    Posts:
    136
    Do you zero out the velocity of the object when it hits the ground?
     
  3. frostymm

    frostymm

    Joined:
    Jun 21, 2013
    Posts:
    34
    Nope, completely slipped my mind. That fixed it, thank you!