Is there any way to set the mass of a rigidbody to less than 0.01?
Thanks!
Is there any way to set the mass of a rigidbody to less than 0.01?
Thanks!
What are you trying to do?
You can set it to less through scripting, but I’m not sure if it’s a good idea (I think the docs say to keep it between .01 and 10).
–Eric
Thanks Eric, I saw that. I’m just wondering if setting the mass to less than 0.01 through script actually does anything different than just setting it to 0.01. I’m also wondering why the mass should be limited to be between 0.01 and 10. IIRC the “standard” units in the physics engine are meters and kilograms, that would mean an object shouldn’t weigh more than 10 kg or less than 10 grams. That’s pretty limiting, especially since many many FPS include ragdoll characters and there aren’t too many soldiers out there who weigh less than 10 kg. ![]()
It probably doesn’t matter that much, but I’m just curious to know that if I set a rigidbody’s mass to 0.005, for instance, it makes any difference to the physics engine than if I were set it to 0.01.
Thanks!
As far as I know mass is completely relative anyway. Two objects will interact the same if one has a mass of 10 and the other 100 versus 100 and 1000. The ratio between the two is all that matters.
The engine isn’t simulating any intrinsic quality of mass/density. You’re probably just going to run into numerical issues at extreme ranges.
Nope, just meters. An object’s mass is only relevant when compared to another object, such as when they collide; it doesn’t correspond to anything. A value of “1” can be a gram or 3,758,235.2981 tons: you decide. Values from .01 to 10 gives you 1000 units to work with…unlikely that you’d really have to deal with objects that weigh more than 1000 times more than any other object. Unless you’re doing a game where you smush ants using planets, or something. ![]()
Edit: In other words, what Matthew said. ![]()
–Eric
I know in some engines, by setting there mass to 0 makes the the object have an infinite mass (ie, can’t move) since most engines use the inverse mass (1/mass) to calculate everything. So an inverse mass of 0 would result in a divide by 0, thus a lot of physic engines treat it as a special case of infinity.
Now there’s a game idea! ![]()
Actually in this particular situation, I’m instantiating a series of prefabs through code that each have a rigidbody and their combined mass is considerably more than I’d like it to be, so I was hoping I could reduce the individual rigidbody’s mass to less than 0.01, to somewhere between 0.002 and 0.005. There are other rigidbodies in the scene, but if I scale them up by a factor of 10, they’ll be well over the engine’s preferred 10 units. What happens when object’s start getting too far beyond 10 mass units? I think the heaviest object I have is around 11 units and I haven’t noticed any ill effects, but I’m guessing that if I bump it up to 110 units I’ll haven problems?
I guess this also leads into the question: Just how mathematically accurate is the Physx engine?
We’ve never clamped our objects at 10 units of mass. Currently we have a jeep weighing in at 750 and everything seems to behave just fine.
Good to know, thanks Matthew.
There is a hard limit in the editor however at 10,000. Under the assumption that the units were kilograms, I have reached this limit before. Aside from that one object however (a really massive ship that interacts with much smaller ships) I’ve never needed to go over 2k. Even assuming Kg.