Basically I have been trying to make my own Friction framework that would allow me to control how much an object can slide on a set surface.
I’ve tried using Forces like BodyForce and BodyThrust but as it turns out, if you put then in a Stepped event and the Client that the code runs on has just a bit of lag, the part would start to shake like crazy. Also if you placed it on a slope, as small as 2 degrees, given the friction force of 100.000 newtons, it would still slide.
Thus, I moved on to BodyVelocity, which were very promising at first. The first test I ran was very successful, the friction force that acted on the part was perfectly adjusted by the roblox engine itself, and upon any lag spikes, the part would not shake at all.
As an example, here I’ve set the part on a 20.224 degree slope, and I’ve set the maximum friction acceleration to 50 st/s^2.
As how you might have noticed, the part accelerated, without shaking.
Also if you matched the Acceleration of the Friction Force to the Gravitational Acceleration, given a certain slope, the part would no slide unless you pushed it. And it would maintain a constant velocity.
As an example, I’ve calculated the Gravitational Acceleration that acted on the part using the formula g*sin(angle) (that would be equal to about 67.827 st/s^2) and I’ve inserted it into the code.
As how you may have noticed, the part stayed still because the sum of the two forces equals 0 newtons. That means no acceleration.
However, If I try to add more than one point that contains the friction force, things start to get messy.
When I split the Friction force into 4 and placed them symmetrically around the part, the sum of the forces, for some odd reason, was smaller than the initial force. I can prove that by running the same test, side by side, of the two systems.
As how you may have noticed, the part that had the force split and place symmetrically around it, for some odd reason, accelerated faster than the initial test prototype.
Not only that, but if you pushed the part in such a way that you applied torque to it, it would not stop rotating even if the BodyVelocity.Velocity is set to a Vector3 of (0,0,0)
Here is an Uncopylocked place that you can test the stuff yourself. Maybe look into my code and see if there is anything wrong with it.