- Home /
Friction in unity?
Is there any friction in unity? If so, how can I change the friction on an object to almost stick to every object it touches? If not, how can I simulate friction?
Answer by MT369MT · Aug 12, 2018 at 03:21 PM
Hi, yes there is friction.
Right Click -> Create -> Physics Material / Physics Material 2D
There is the Static / Dynamic Friction and the Bounciness values that you can change. Then simply add the physic material to the objects you want to affect with friction.
Answer by TheEmeraldRuby · Aug 12, 2018 at 03:10 PM
Give your object a rigidbody component and adjust the angular drag.
O$$anonymous$$, I saw your other post and I may have a solution. I suppose you could have the feet detect for collisions and if the collision returns as the floor you could set its velocity to 0. If you want them to stick like they're nailed down, make it so every frame the foot is touching the ground its velocity is set back to 0. To lift it again, tell the game that when a button of your choice is pressed, the function cancels and thus the foot can come up. I hope this helps!
forget what i said about rigid bodies i was thinking of something else
Angular Drag is used to slow down the object rotating. If it is 0 the object will rotate forever. If it is large it will stop early rotating.
Okay, so I just applied what you guys said, and it is working great. Right now, I have empty objects that the hands and feet try to go towards. That is how I am having it walk, I animated the empty game objects. So the way the hands and feet go towards them are with Constant forces set to where they will go towards, but still constrained. I don't feel like it is working that great, I have the force that goes toward the empties * 100000, and any higher will start to glitch. So what else could I do to allow the feet and hands to go toward the empties?