Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. The Burst compiler has its own forum section now.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Calculate mass held by rigidbody 2D

Discussion in 'Scripting' started by FabrizioSpadaro, Feb 19, 2020.

  1. FabrizioSpadaro

    FabrizioSpadaro

    Joined:
    Jul 10, 2012
    Posts:
    285
    Hello, I have a "simple" question, is there any way to calculate how much weight a rigid body is holding?
     
  2. TheDevloper

    TheDevloper

    Joined:
    Apr 30, 2019
    Posts:
    18
    Well, their is an option attached to the rigid body is called mass go check it out.
     
  3. FabrizioSpadaro

    FabrizioSpadaro

    Joined:
    Jul 10, 2012
    Posts:
    285
    Yeah, well I know that every object has a mass, but how can you calculate how much muss is HELD by 1 rigid body.

    Imagine you have a plane, and on top of this plane you have 30 more rigid bodies, how can you calculate how much mass that plane is holding?
     
  4. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    2,586
    Calculating the mass would be simple- just add 'em all up. It sounds like the real problem is how to figure out which objects are "held". Maybe you could use colliders for that.
     
  5. FabrizioSpadaro

    FabrizioSpadaro

    Joined:
    Jul 10, 2012
    Posts:
    285
    Well not even that, because some objects could distribute some of their mass outside my target.
     
  6. FabrizioSpadaro

    FabrizioSpadaro

    Joined:
    Jul 10, 2012
    Posts:
    285
    I think I found my solution, and I will be using reactionForce.magnitude of a spring joint
     
    TheDevloper likes this.
unityunity