# Rigidbody unwanted drifting

Hi everyone!
yet another question on physics stuff…

I’ve got a simple scene with a cube and a plane.
The cube has a box collider and a rigidbody attached while the plane has just a mesh collider attached.

I made a simple script to make the cube slide on the plane, according to user input, that only applies forces to its rigidbody.
I used the following code to make it move on its forward direction:

``````float vaxis = Input.GetAxis("Vertical");
``````

Drag and angular drag are set to zero.

Since there are no physic materials attached to any object in the scene and the physics settings are set to default values, I would expect the cube to slide in its forward direction without changing its orientation but this is not what I get.
Its rotation params slightly change and the result is that the cube is not moving straight forward, but is following a curved trajectory on the plane that I can not control.

If gravity is disabled on the cube or if I freeze rotation, everything works as expected but this is not a solution in my case.
Why is this happening? Am I missing something in the way rigidbody or physics works?

Any help is appreciated!

EDIT -----------

I forgot to mention that I set the cube’s rigidbody center of mass to (0, -1, 0) to make the cube slide and not roll…

I’ve run into this problem and yes, setting dynamic friction to 0 stops it, but this is not accurate to the real world.

I also seems the higher the friction the more forceless sliding takes place. Again, opposite to what one would expect!

Yes this effect is very much expected (basic Physics). The friction force is making the cube to rotate. So you have two options

1.Freeze Rotation

2.Add a physics material( set friction to 0 and rest options to minimum) and the material to box collider (i.e cube ).

This was my problem.

Another solution is to put a rectangular collider on the bottom part of the object so that it doesn’t spin. At least that’s what worked for me. Yes I realize this is 6 years old but hey if I’m reading it someone else will be too. Good luck!

I also encountered two similar problems. One is a robot similar to a biped robot. When the left and right input signals are the same, the robot’s forward direction will be deflected; the second is an underwater drone. When the robot rotates in an unstable pitch direction, the robot will appear in the front and rear directions drift.