- Home /
Delaying Physics Calculations (Friction)
Hello, I am currently trying to create a BunnyHop-Script for my game. When the player lands, he should have 2 frames time to press the Jump-Button without getting any friction, meaning he can keep his velocity that way without slowing down, causing him to spam the Jump-Button. How would I approach that? Any help is greatly appreciated ;)
Comment
Answer by xxmariofer · Mar 06, 2019 at 10:13 AM
somethiing like this should do it, mat is a physical material with the friction desired.
IEnumerator Test()
{
float dynamicFriction = mat.dynamicFriction;
float staticFriction = mat.staticFriction;
mat.dynamicFriction = 0;
mat.staticFriction = 0;
yield return new WaitForSeconds(2);//2 seconds
mat.dynamicFriction = dynamicFriction;
mat.staticFriction = staticFriction;
}
Your answer
Follow this Question
Related Questions
Similar movement to a game (look description) 1 Answer
How to apply frictional Torque 2 Answers
Friction in unity? 2 Answers
Distribute terrain in zones 3 Answers
Friction between two rigidbodies 0 Answers