Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question physics object floating?

Discussion in 'Physics' started by ChuckieGreen, Nov 23, 2022.

  1. ChuckieGreen

    ChuckieGreen

    Joined:
    Sep 18, 2017
    Posts:
    360
    Hi, I have an object that has a rigidbody attached and is effected by gravity, however the object seems to not sit flush with other objects in the scene, as can be seen in the image. Shouldnt the object sit directly on top of the ground objects collider (the white object) ?

    upload_2022-11-23_2-38-0.png
     
  2. Strafe_m

    Strafe_m

    Joined:
    Oct 24, 2022
    Posts:
    72
    You might have selected constraints for it's position on the RB, maybe check that?
    And is this picture in play mode?
     
  3. ChuckieGreen

    ChuckieGreen

    Joined:
    Sep 18, 2017
    Posts:
    360
    Hey thanks for the reply. None of the contraints are selected, and yes the screenshot is from playmode.

    Also, in case it is any help. When I pause play mode and increase the Y position of the red cube, then unpause, the red cube falls into the same position, so gravity is working. Just seems to be that small gap
     
  4. Strafe_m

    Strafe_m

    Joined:
    Oct 24, 2022
    Posts:
    72
    Do you mind sending a photo of your rigidbody component on the object.
     
  5. ChuckieGreen

    ChuckieGreen

    Joined:
    Sep 18, 2017
    Posts:
    360
    upload_2022-11-23_2-56-31.png
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,589
    It's a collider you're not showing also attached to the same RB or maybe you've changed the default-contact-offset in the physics settings to something huge?

    How many world units is that "gap"? I don't mean pixels. Is this box tiny and the "gap" is the normal tiny default-contact-offset?

    Look at the "Contacts" (as seen above) on the Rigidbody2D and the Collider2D when it stops. Is it contacting anything.