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

Question Is it safe if I put less mass than the normal for the rigidbodies in my game?

Discussion in 'Physics' started by LeLoicLe, Jul 3, 2020.

  1. LeLoicLe

    LeLoicLe

    Joined:
    May 27, 2020
    Posts:
    25
    HI
    So I am making a flying space machine, that can be controlable, and I realised when I put a lesser mass (1 instead of 100) my script behave way way better.
    But it is forcing me to adjust the mass of all the rigidbodies in my game...
    So is it ok if I put less mass to my rigidbodies (lets say like 1:1000 for instance)?
    Will physics be weird?
    Thank you. :)
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,193
    That shouldn't technically be a problem, since as far as I know, physics interacts are about relative mass rather than absolute mass. You can convince yourself of this by making a pile of cubes with Rigidbodies on them, and letting them all fall to the ground and bang into each other. Then change the mass on each of them to 100,000, and you'll likely see no difference in behavior.

    However, it's much easier to avoid weird interactions if you try to keep your masses close to realistic. In the above example, the big difference occurs if an 80 KG character walks into the blocks. On one case the blocks will move out of the way. In the other, they won't budge at all. It gets tricky if you start messing with mass just to get one script working better.

    So, I'd highly recommend you figure out why your script is mass-dependent, and fix that. Ideally your script would run identically regardless of mass. Care to share the code that behaves different depending on mass? Maybe you're just missing something simple, like not realizing that the different ForceModes used with AddForce can change the behavior.
     
    LeLoicLe likes this.
  3. LeLoicLe

    LeLoicLe

    Joined:
    May 27, 2020
    Posts:
    25
    HI
    So i tried what you told me, by changing the forcemode in the script, and I have to thank you for that, because now whatever I put a mass of 1 or 1000 the thing is acting the same.
    It is not perfect right now but It needs work in order to be like this. :)
    Thank you very much. :)
     
    dgoyette likes this.
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350