Friction on X with circle collision shape
Hi guys, i cant find a way to solve this, when i change an actor collision shape to circle, it wont have friction on X, i solved this with a behavior that reduce the linear velocity each 0,01 second but i m sure there is a better way to do this, using less resources
Best Answer
-
tenrdrmer Posts: 9,934
it will still have friction you just need to turn it up higher. Also you can turn up the friction on what ever you are rolling on.
Answers
Hi Tutyses. I just had the same issue and found the solution by searching about it for Box2d, which is the engine GameSalad relies on for friction. For anybody else reading this: Whenever you have a physics issue in GameSalad that you cant find an answer for, google it for Box2D. That might give you the answer. Anyway:
"Box2d does not support rolling resistance. As a consequence, circles roll forever on flat surfaces with no damping."
This means that you need to apply your own rules for this, and reducing the velocity as you are doing is a viable solution.
I would suggest that you use a combination of multiplication and Math.floor on you the velocity, to make it's decline a product of it's initial velocity. If you look at a soccer ball on grass, for instance this is approximately how it works.
Also, you are now free to add a multiplication factor in there to determine the ground friction - for example, I am building a golf-based game, where the grass and sand bunker will have different values for this.
Hope it helps!