Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Gravity not working on rigidbody

Discussion in 'Editor & General Support' started by sciguy77, May 4, 2010.

Thread Status:
Not open for further replies.
  1. sciguy77

    sciguy77

    Joined:
    Nov 1, 2009
    Posts:
    191
    Hi,

    I have a rigidbody and I have checked the "use gravity" box however it does not fall. I then tried to use rigidbody.useGravity, though there was still no effect.
     
    CGDever and ocimum like this.
  2. GargerathSunman

    GargerathSunman

    Joined:
    May 1, 2008
    Posts:
    1,571
    Is the rigidbody kinematic? It ignores the gravity if isKinematic == true.
     
    ocimum likes this.
  3. sciguy77

    sciguy77

    Joined:
    Nov 1, 2009
    Posts:
    191
    Nope, the kinematic box is unchecked. :/

    I also added:

    Code (csharp):
    1.  
    2. rigidbody.isKinematic = false;
    3.  
    4. rigidbody.useGravity = true;
    5.  
    but still nothing...
     
    ocimum likes this.
  4. GargerathSunman

    GargerathSunman

    Joined:
    May 1, 2008
    Posts:
    1,571
    Well, that leaves three options. One, it's colliding with something and can't fall. Two, it's so big that you can hardly see it move. Three, the visible object isn't the object being affected by gravity.

    Unless I can see the scene I can't really say one way or the other.
     
    SkiefORG, K_Bos and LuisMaps like this.
  5. sciguy77

    sciguy77

    Joined:
    Nov 1, 2009
    Posts:
    191
    I've attached a screenshot of the scene. The car's mass is 3000 kg, and I can move it forward and turn it fine, it just does not fall.[/img]

    As you can see, the correct boxes are checked. Anyone know why this is happening?
     

    Attached Files:

  6. sciguy77

    sciguy77

    Joined:
    Nov 1, 2009
    Posts:
    191
    Any idea why this is happening?
     
  7. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    In the editor, select debug mode for the inspector. Then, set the game playing to a point where the car should be falling. Then, switch to the scene view and select the car in the inspector. If gravity is working, you should see the Y position value of the transform decreasing. If this is happening, but the car doesn't seem to be falling then it probably means that the scale of the models in the scene is enormous. Essentially, it is like looking at vast objects from a great distance. It is common for a 3D app's export options to make an object a hundred or a thousand times larger or smaller than it should be. You can fix this at the modelling stage or else change the scale values in the object's transform within Unity.
     
  8. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Lower the drag of the rigidbody.
     
    Benfont, Comafly, freebly and 2 others like this.
  9. Veerababu.g

    Veerababu.g

    Joined:
    Oct 8, 2015
    Posts:
    2
    even am facing the same problem any help
     
    Jaymaster2014 and CGDever like this.
  10. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    Same here, maybe it's the Unity build.. I'm using 5.3.2f1
     
    CGDever likes this.
  11. jacovberg

    jacovberg

    Joined:
    Nov 28, 2014
    Posts:
    1
    Edit > Project Settings > Time
    Time Scale should be set to 1
     
  12. MFKJ

    MFKJ

    Joined:
    May 13, 2015
    Posts:
    264
    what happened solved?
     
  13. Darioszka

    Darioszka

    Joined:
    Jan 22, 2015
    Posts:
    12
  14. patr15

    patr15

    Joined:
    Apr 5, 2017
    Posts:
    1
    For me it helped to uncheck the checkbox "static" in the inspector (in top-right corner)
     
  15. enunez810

    enunez810

    Joined:
    Dec 1, 2016
    Posts:
    1
    spacehank and emilija69 like this.
  16. diegoadduci

    diegoadduci

    Joined:
    Jun 24, 2017
    Posts:
    1
    for me too!! thanksss!!!
     
  17. tlucz

    tlucz

    Joined:
    Apr 11, 2014
    Posts:
    1
    It can be also "Freeze Position" on Y axis checked.
     
    AryoZax and llamapuppies like this.
  18. TheCreatorOfExistence

    TheCreatorOfExistence

    Joined:
    Sep 6, 2017
    Posts:
    1
    my characters go up as soon as i start
     
    Dash_Sparrow likes this.
  19. CGDever

    CGDever

    Joined:
    Dec 17, 2014
    Posts:
    156
    I have the same very magical problem. I still do not believe in it, but I can observe in my project. There are 2 cube in the scene. Cubes have a mesh-renderer, colliders, physics and nothing else. The cube 1 is on the cube 2. These cubes are dynamic, their sizes are normal and the mass is 1 kg. I do not change the gravity of the cube 1, just do not touch it.

    Then begins the magic.
    If I run the project, cube2's RB.isKinematic = true and call Cube2GameObject.SetActive(false) through Editor, then all as usually, сube1 falls down.

    If I do the same on mac, but I change the position of the cube2 through RB.position, then the cube 1 hangs in the air. If it is slightly pushed, it falls.

    I'm not looking for an answer to what's going on, I think that nobody will help with this, except Unity's team.
     
    JustinTheSwift likes this.
  20. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,232
    Can you file a bug report with a sample project? We can take a look and see what's going on.
     
  21. FungusMonkey

    FungusMonkey

    Joined:
    Jun 30, 2016
    Posts:
    41
    Yep.. That did it thanks. Was driving me nuts. Large trees would fall even though static but smaller would not. Hmmm?
     
  22. TommH

    TommH

    Joined:
    Mar 22, 2018
    Posts:
    1
    I've been experiencing a similar problem and it was because the rigidbody was going to sleep due to inactivity. Calling rigidbody.WakeUp() or applying a small force solved my issue.
     
  23. augivision

    augivision

    Joined:
    Mar 27, 2018
    Posts:
    14
    I FIGURED IT OUT!

    The scale of your object in the scene has everything to do with it. If your object is scaled too large in the scene, even with a mass of 99999999999999999999999 it will not move.

    I scaled my entire scene down and Everything works great!
    Thank you andeeee!


    EDIT:

    Instead of scaling your scene down and rearranging your assets, it's easier to change the amount of pull in the negative Y direction for gravity in the physics manager. No matter what scale your scene is, adjust this should fix your issue.



    https://imgur.com/a/NvJJw
     
    Last edited: Apr 2, 2018
    John3856 likes this.
  24. alininavcisi

    alininavcisi

    Joined:
    Mar 10, 2015
    Posts:
    8
    Check Edit->Project Settings->Physics2D and check "Auto Simulation".

    And also check "Simulated" in rigidbody component.
     
  25. SquareMike

    SquareMike

    Joined:
    Apr 30, 2013
    Posts:
    1
    My God man, you saved us from a life of travesty. Did you hurt yourself when you fell from heaven? We would not have thought of this were it not for your 4 year younger self. No sarcasm truly; but do you know why it happens?
     
  26. wadavie

    wadavie

    Joined:
    May 25, 2018
    Posts:
    4
    thanks @augvision. I went to Edit->Project Settings->Physics2D and notices the x and y values were at 0. I cahnged the y to 10 and it started falling.
     
  27. robin_lenaerts2011

    robin_lenaerts2011

    Joined:
    Mar 15, 2019
    Posts:
    1
    this fixed it for me thanks! weird that an update would reset the time scale...
     
  28. Castlesky_Productions

    Castlesky_Productions

    Joined:
    Jul 13, 2019
    Posts:
    1
    Yo that actually worked. Thanks!
     
  29. alti

    alti

    Joined:
    Jan 8, 2014
    Posts:
    94
    make sure edit > project settings > Y has a value.
     
  30. Wietsje

    Wietsje

    Joined:
    Oct 14, 2019
    Posts:
    1
    Well for me the problem was that I had hinge joints attached to the body and disabling that helped for me.
     
  31. Zvirgzds

    Zvirgzds

    Joined:
    Oct 6, 2019
    Posts:
    2
    I also stumbled upon this issue.
    Basically if I set useGravity in the script it may not force RigidBody to fall.

    Any interaction with item automagically tells RigidBody to fall. (Dragging over another object in edittor for example, or switching useGravity off and on, or switching isKinematic on and off.).

    It appears that follwoing helps to fix issue:
    1) Adding small force to RigidBody (It also looks cool to add small Torque)
    2) Use FixedUpdate instead of Update
    3) Keeping isKinematic == true for objects that you don't want to fall and be impacted by others, and setting isKinematic to false when objects needs to become "alive" and start falling

    RigidBody.WakeUp() did not fix the issue for me.
     
    sivrikaya likes this.
  32. JustinTheSwift

    JustinTheSwift

    Joined:
    Feb 4, 2017
    Posts:
    5
    I'm having a very similar problem to Rotecks.

    I've got box A and box B. At the start of the scene, box B is positioned directly above box A, in the air. I watch in fall and land on box A. Gravity works up to that point. Then my character grabs box A and moves it with the expectation that box B will fall into its place, but box B just hangs in the air.

    Using rb.WakeUp() worked for me.
     
  33. naman97

    naman97

    Joined:
    Feb 28, 2020
    Posts:
    1
    Have you unchecked the 'y' check box under contraints in the Rigidbody component? I did this silly thing and wasted a lot of time trying to solve the same problem.
     
  34. Mokka_21

    Mokka_21

    Joined:
    Oct 23, 2019
    Posts:
    1
    Hi there,
    I have a problem. I ticked once in my inspector window that my object is kinematic. And from that time my gravity has been broken. I can ride my motorbike through the objects and motorbike does not fall in the beginning. I tried so many tips on the forums, but any of these didn't help. Can anyone help me with this? Sorry for my English.
    Thanks
     
  35. Xopherdesign

    Xopherdesign

    Joined:
    Jul 26, 2015
    Posts:
    1
    This was my issue, thanks
     
  36. unity_1DOzmROLl9Bz_Q

    unity_1DOzmROLl9Bz_Q

    Joined:
    Aug 8, 2020
    Posts:
    2
    Just had a similar problem. For me, I am using a cube for the 'ground'. The box collider on the ground was 50xs larger than the object itself. I selected box collider>reset and that fixed everything
     
  37. Kaanongu01

    Kaanongu01

    Joined:
    May 19, 2019
    Posts:
    1
    Maybe you accidently tick to "Freeze Position".(rigidbody>constraints>Freezeposition)
     
  38. jcbena2015

    jcbena2015

    Joined:
    Oct 7, 2020
    Posts:
    1
    I have problems with rigidbody, scale 1, gravity v , no freeze x,y,z; Unity 2019.4
     
  39. TjazS

    TjazS

    Joined:
    Jul 3, 2020
    Posts:
    1
    I just added a collider to the gameObject (with rigidbody) and now it works.
     
  40. bentoBAUX

    bentoBAUX

    Joined:
    Mar 12, 2017
    Posts:
    2
    Do you, by chance have a script in Update() that is assigning a position to the Game Object? If so, that might be the reason.
     
  41. adammnz

    adammnz

    Joined:
    Jan 23, 2021
    Posts:
    1
    I had this issue and if it helps anyone experiencing the same, I had inadvertently set a "Freeze Position" on the Y axis, under "Constraints" for my Rigidbody. Unchecking fixed the issue, might help someone
     
  42. VixaGame

    VixaGame

    Joined:
    Aug 16, 2017
    Posts:
    1
    Project settings -> Physics -> Reset - help me
     
  43. FerretGuy_

    FerretGuy_

    Joined:
    Apr 15, 2021
    Posts:
    2
    i have a program that makes the character able to move that might be the cause
     
  44. Dash_Sparrow

    Dash_Sparrow

    Joined:
    Jun 10, 2021
    Posts:
    1
    Yeah same here
     
  45. RahajulAmin

    RahajulAmin

    Joined:
    Mar 22, 2018
    Posts:
    2
    Delete the game object and create the object again and add rigidbody. Hope this will solve your problem.
     
  46. constantinpopp

    constantinpopp

    Joined:
    Jul 21, 2017
    Posts:
    5
    thanks!! this helped me.
     
Thread Status:
Not open for further replies.