friction between two rigidbodies

Hi, all. I have a simple question about friction between two rigidbodies. As the picture below, I make two cubes and add the physic material to the both colliders. Both dynamic friction and static friction are set to 1.

When I use the rigidbody.MovePosition() function to move the bottom cube, the cube above doesn’t follow the bottom cube and seems there is no friction between the two cube. I check the website and see someone suggest to use rigidbody.addforce(), which is actually work.

Here is my question: Is there another way to make the friction work in the position control? or I must use addforce() function which is in force control to make the friction work. Many thanks!
3315175--257777--upload_2017-12-7_15-41-22.png

3315175--257777--upload_2017-12-7_15-41-22.png

You have two choices that would work:

  • Make the bottom cube as Kinematic, then use MovePosition for moving it.
  • Leave the bottom cube as non-Kinematic, then use Rigidbody.AddForce for moving it.

All calls must be made from FixedUpdate.

Note that in the second case you may impose a velocity to the non-Kinematic rigidbody by calling AddForce with the parameter ForceMode.VelocityChange. But I’m unsure on the result here.

Thank you so much! After making the cube as kinematic, the friction works!

1 Like