- Home /
Change size of rigidbody programmatically
I have some objects which are connected with each other by hinge joints. I need to change their sizes, but when I try to change their size with transform.localScale, the anchor point doesn't update. So how do I change size of connected rigidbodies correctly?
Answer by LoneMonkey · Oct 13, 2015 at 09:08 AM
Scaling an object will always scale from both sides like shown in example 2 and not move the hinge point. To overcome this you could simply move the object 1/2 the scale size after scaling it or possibly make an empty game object, place your visible cube as a child of the empty then scale the empty instead of the visible this should scale your visible object from only one side and thus keeping the other end at the original hinge point.
Your answer
Follow this Question
Related Questions
stop vehicle from moving through walls 1 Answer
Rigidbody parent affecting rigid body of a child 2 Answers
My character moves under the terrain at strange Y position 1 Answer
Clamping rigidbody's Z position causing issues in the editor, when transform hits zero on Z axis 0 Answers
physically based animation 1 Answer