0

I'm very new to Unity, and I'm just playing around with a dice rolling simulation. I have a single cube with a rigid body and the StandardAssets DragRigidbody script associated with it. When I run the preview, I can drag the cube around just fine, and if I fling the cube it flies off in that direction and rolls around just like I would expect it too.

A problem occurs when I duplicate the cube and run the preview. Both cubes can still be dragged around, but they cannot be flung. If I try to fling either of them, the moment I let go of the mouse button the cube stops moving completely. If it happens to be in the air at the time, then it floats back down very, very slowly as if there is almost no gravity.

I actually do know what's causing this behavior, but I don't know why it's happening. These are the Rigidbody properties for the cube(s) before I run the preview (the values that I want):

Mass: 1
Drag: 0.5
Angular Drag: 0.5
// The rest are defaults

...but when I run the preview with more than one cube, I can see the values change as soon as I drag a cube to these:

Mass: 1
Drag: 10
Angular Drag: 5

So this is what's causing the loss of fling functionality. The values don't change with only one cube, so why do they change with multiple cubes?

4

1 回答 1

1

事实证明,与每个立方体关联的 DragRigidbody 脚本的 Drag 和 Angular Drag 属性覆盖了每个 Rigidbody 的相同属性。DragRigidbody 脚本值分别为 Drag 和 Angular Drag 的 10 和 5,而我之前从未注意到它们。

我仍然不知道为什么我只有一个立方体没有问题。在任何情况下,将 DragRigidbody 脚本的值设置为与 Rigidbody 中的值相同即可。

于 2014-02-27T17:20:19.973 回答