Home > Mobile >  How to prevent from the player to slide down a bit on the terrain?
How to prevent from the player to slide down a bit on the terrain?

Time:07-14

I want at this point that the player will stay and will not slide down because the player get interaction with the box and when he move a bit to the side he lost interaction.

I don't want to disable the player movements controls or to make the Rigidbody of the player Is Kinematic true because i want that the user will be able to move to the player but if the player is not moving the player the player should stay and not sliding down a bit.

player sliding down a bit and lost interaction with the box

This is a screenshot of the player components settings :

player components settings

The player collider material settings :

player collider material settings

And last the terrain collider material settings :

terrain settings and the terrain material settings

CodePudding user response:

You could only activate Is kinematic when it is standing still. When it starts moving again you can turn it off. If you don't want to use it, there are other options: change the material when it stops, assigning one to the player with the highest Dynamic and Static Friction settings; activate Freeze Position in the Rigidbody; Make the player static; record the position as it stops and assign it to transform.position for each frame in the Update() method; increase the mass by a lot..

If I was helpful, you can thank me by marking this answer as accepted :)

  • Related