Freezing rotation breaks friction for BoxColliders

I have a pretty simple 3d scene with a box collider representing the player on top of a large, flat, and planar box collider. When I apply force on the player’s rigidbody purely on the positive x-axis, I also get positive motion on the z-axis. When I apply force purely on the positive z-axis, I also get motion on the positive x-axis. Finally, when I apply force purely on the negative z-axis, I also get motion on the negative x-axis.

I’m a beginner to unity, so it’s possible I’m overlooking something stupid. I would expect that when I apply force on one axis, I wouldn’t see motion on another. This effect is absent without gravity, so I guess it’s due to friction. Is this an unavoidable side effect of the physics engine?

I’m applying the force simply as follows:

void FixedUpdate() {
	myRigidBody.AddForce(Vector3.right * Input.GetAxis("Horizontal") * WALK_FORCE);
	myRigidBody.AddForce(Vector3.forward * Input.GetAxis("Vertical") * WALK_FORCE);

Update: Disabling useConeFriction on the player’s rigidbody as well as increasing the physics iteration count in the project settings greatly reduces this effect, although it’s still present

Update 2: I believe this is a bug with the way rotation is frozen in the physics engine. I have uploaded a demonstration of this issue [|7047]. Use WASD to move the two objects in the scene. If you watch the box object in the Scene Hierarchy, you will see that as you move it back and forth along one axis, it will also move on the other. If you watch the sphere object, you will see it does not have this effect.

You can do what you’re talking about, but you aren’t going to want to apply a force. You’re going to want to directly translate the transform – aka controlling your rigidbody via kinematics. Check the box marked ‘is kinematic’ on your rigidbody and try the following.

transform.position = transform.Translate(Vector3.right  * Input.GetAxis("Horizontal") * WALK_FORCE);

And go ahead and give it a shot without that box checked. I forget if the box will still want to be fricative or not, but if it doesn’t then at least you can still bump it around using physics.

Also, you might experiment with changing Vector3.right/forward to transform.right/forward. They mean totally different things and will produce very different results depending on the orientation of your rigidbody. I hope that helps you. Enjoy!