Move rigidbody cube without it tumbling

I’ve got a cube as a player, that I want to move around on top of a larger cube. The cube has a rigidbody as I want it to tumble and fall off the edge if you get too close. I’m using AddForce() to move the cube around, but for some reason it tumbles as it moves, and I don’t want that to happen. I want it to slide effortlessly over the surface.

I don’t want to constrain the axis, because I want it to tumble and fall. So how else can I stop it from tubling, is this because my drag is too high? I don’t want the drag too high or it will be too slippery.

The stats are:

Mass: 20

Drag: 1

Angular drag: 0.1

Here’s how I move the cube forward:

GetComponent.<Rigidbody>().AddRelativeForce (Vector3.forward * 20, ForceMode.Impulse);

Five solutions :slight_smile:

You can try by changing the physics material of the colliders, so it feels not just “less” drag, but different. In the standard assets there are some examples, maybe “metal” could be good for you. With P.M. you can differentiate between dynamic and static friction.

The second idea that came into my mind is to check that the force to move the cube is applied ON THE BOTTOM of the cube (actually applied force must be below the center of mass, so below 0.5 of the height), so that it should not rotate while pushing. That is the cleanest soution imho.

One more solution: apply a huge angular drag.

One idea also could be to put a fixed collider on top of it, as a sort of invisible ceiling, that avoids the cube to rotate.

Otherwise, there’s no real solution to defeat physics when you want and make them present when you want: you can simply move the cube using transform.Translate(), so you won’t apply a real force and it won’t use physics until it will fall down.

Freezing rotation on X, Y and Z will do the trick. No code required.