Why the object after scaling at run time slide and shaking on the plane.
My scene has only a place( scale it 7 times larger ) and a cube with rigidbody( use gravity and freezerotation ), turn the cube around the up axis a little bit. In a script
function Update () {
if( Input.GetMouseButton(0) ){
scale = Input.GetAxis("Mouse X");
transform.localScale += Vector3.one * scale;
}
}
whenever the cube is scale large enough during run time it will start sliding and shaking. Can anyone please help me solve this problem?
Thanks in advance.
I tried your code out, and yes the cube does start bouncing around if you make it big enough.
What seems to solve the problem is to give the rigidbody a little drag.
When a cube is enlarged, the movement generated by the scaling will give a small velocity for small cubes, but a larger veloctiy for large cubes.
A small velocity will fall below the “sleep velocity” (which is set up under the “Edit/Project Settings/Physics” menu.)
However, once you have a sufficiently large movement this threshold will be exceeded, and the object will keep moving.
But, as I said, adding a little drag to the rigidbody calms things down.
Thanks cblarsen, that’s solved my problem.
