Here is the simplest scenario:
Object A with rigidbody (mass 1 and scale 1,1,1) placed in the object B.
Scaling the object B, object A physics behave unusual, not like unscaled. For example, adding the force, smaller scale will be affected too much and vice versa.
In my case I also use gravity compensation force (to simulate very light objects, like paper or balloon) and I can’t get, how to calculate the force I need to apply to make the result same for any scale of container object B.
Couldn’t find any notes in docs or google about it.
Hello @novaVision , for me the behaviour sounds correct. Scaling is inheritet to children. When you add same force on a normal scaled (child) object and a smaller scaled (child) object and the smaller one will be stronger effected than the normal then everything sounds fine for me. And for a bigger scaled vice versa sounds fine too. If that’s not what you meant then it’s hard to know what your issue is without further information.
Greetings David
Keep in mind that a larger object looks like it falls slower. First of all during play mode it’s worth selecting the rigidbody and unrolling the info foldout so you can examine the actual velocity of the object.
If you drop the object and check this at a scale of 1 and at a scale of 10, you should find it is the same velocity magnitude.
Well, I can’t agree this is expected behaviour. The scaling in most cases is used for visuals changes, animations. As soon as Rigidbody mass (or other parameters) is not changes, it’s logically correct to expect the same physics behaviour.
Sure, I understand it.
Here is my case in details, so it may be more clear:
I got the object - balloon by default in deflated state (uniform scale 0.3). The balloon is placed into the container, which may be scaled up/down by a user within the range of 0.5-2.0.
If user tap on balloon, it become inflated and restore it’s normal scale to 1.0. At this point I compensate gravity adding up force in FixedUpdate (Vector3 (0, 0.95f, 0) with the RB mass set to 0.1f. Later, user may hear/cool (also within the range of values) the balloon adding some additional uplift force so the balloon may float up/down accordingly.
Everything work fine if container scale is 1.0, but if I change it to 0.5 or 2.0 I see the uplift force applied to RB moves the balloon too much on minimum scale, and not enough on max scale.
So, that’s the case. Looks like @D12294 suggestion is correct in spite of it doesn’t sound logically to me. But… I didn’t get how to deal with that. Lets say if I scale container to 2.0 from 1.0 the (what is x2) it doesn’t mean that I need to add 2x uplift force (tried - it’s way too much).
“scale container” doesn’t mean anything with respect to Unity physics so maybe you can use terminology that applies to Unity. For instance, if you mean you’re using Transform scale or something else then please state that.
In the end for 3D the default is to explicitly state mass so the forces required to effect a change in velocity won’t change with the “size” of colliders. Their positions and sizes will affect the center of mass but the mass is independent of scale.
As an example though, in 2D you can use “Auto Mass” which automatically calculates the mass based upon the collider area and density.
By “in” do you mean Object A is a child of Object B? Again, try to use the correct terminology to avoid these ambiguities.
You should do this without parenting (do not parent rigidbodies), or Unity will constantly affect the results in unusual ways. The manual mentions this as well. For example Unity will attempt to move the child (which is affected by scaling of parent) along XZ but not Y, which it applies gravity to. It’s not reliable for modelling behaviour, so don’t parent them.
For many years of working with Unity, the term “container” has always been clear between developers to describe a “parent” - an object that contains other objects. I don’t understand what your lightning throwing is connected with.
Ok… so if I understood correctly to fix my issue I need to remove all rigidbodies from the parent (scaled object) and scale all of them separately because scaled rigidbody with null parent will be affected by physics in expected way, right?
So given my many years at Unity and on these forums, I guess this means I must’ve missed this (apparently) well known synonym. Transform scale is well known and explicit as is using the terms parent and child. If I don’t know what you mean it also means other potentially don’t either. I said what I said because clear communication on what you mean is important so removing ambiguities is too. It seems you think I somehow have some other reason to state what I said (lightning?) so I’ll leave you to it.