- Home /
scaling objects with rigidbodies
I have prefabs that have collider, rigidbody and their size and mass are set to correspond to realworld meters/kilograms.
Now I want to instantiate these prefabs at different uniform scales (scales ranging from 0.2 - 2.0).
My question is, how does scaling (changing transform.localScale) affect physics? does the physic engine already consider the uniform scale for it's calculation, or do I for example have to multiply the rigidBody mass by scale^3? what about drag?
Answer by iwaldrop · Jan 16, 2013 at 12:51 AM
You would indeed need to alter the mass and drag manually. Luckily, rigidbodies don't care about size; the aggregate of a GameObject's colliders give it it's dimensions. So just scale your gameObject and set the mass and drag by a factor of whatever you scaled it by!
Answer by JonathanWebb · Feb 28, 2017 at 07:34 AM
// Instantiate the RigidBody Rigidbody newBody = Instantiate(object, transform.position, Quaternion.identity) as Rigidbody;
// Scale the game object associated with the RigidBody by 15 (i.e. 15 times larger than normal). newBody.gameObject.transform.localScale *= 15.0f;
Your answer
Follow this Question
Related Questions
What should my gravity be if I've modeled in feet and inches in Max? 3 Answers
Rigibody2D.AddForce within a scaled GameObject 0 Answers
Change Gravity? Physics scaling for large objects to behave like normal ones... 0 Answers
Detecting When Intersection Penalty is Being Applied 2 Answers
Long-distance physics 0 Answers