However, friction keeps the object from reaching this top speed. When there is no friction, it works flawlessly. But I need friction for other things, such as slowing to a stop, or making the object move along with any rigidbodies it’s sitting on.
So this brings me to two ideas.
1: Find a way to overcome this friction within AddForce.
2: Completely remove friction from the object, and apply it directly when necessary.
However, I would have no idea where to start when applying friction manually. I’m not even sure how friction works.
Hmm, I just looked something up. From what this says, friction applies a force against the object equal to the force applied to the object, times the average between the objects?
Like, if the average between the object and surface was 0.5, it would effectively cut the force applied in half? And total friction of 1 would stop it completely?
I’m guessing the “average” they’re referring to is the coefficient of friction? If I remember correctly, it’s calculated by the Normal force (for example, the force of gravity a box exerts onto the ground) multiplied by the coefficient of friction (how well the two objects “slide”; ice has a very low coefficient whereas sticky rubber has a very high value). This force works against getting an object moving, and slowing down an already moving object.
Like I suggested though, look into using “Drag” in the existing physics engine; it may already provide a good enough effect for what you need.
Hm, I see. Testing it out, the downward force does have an effect on the amount of sideways force required. Still trying to look up the exact math behind it.
Drag wouldn’t exactly be what I need, since if my frictionless object were sitting on a moving platform, drag wouldn’t make it move with the platform.
As I want it to be as emergent as possible, I’d want to make my “move” function add exactly the amount of force required to accelerate up to top speed, accounting for friction. Effectively, exactly the way moving feet would against ground. A person’s steps add to his momentum based on the force applied from the leg to the bottom of his shoe against the ground. Friction helps in this way, but for a collider that can’t do this, there would have to be a force that overcomes friction.
Or that less realistic and emergent method, eliminating all friction and applying it manually.
I suppose I am putting too much thought into this after all. I do tend to over-complicate things. Which can make it insanely difficult to program something simple. But this process helps that sometimes.
Video games don’t have to be so realistic! That frictionless method should work fine, and I can manually decelerate the object based on his own ability to stop moving.
Although… that would cause problems with gravity, since there’d be little way to stop sliding down a surface without manually applying a force opposite gravity. Which would in-turn screw up the resistance gravity is to apply in basic gameplay…