Jump to content

Some Experiments on KSP's Friction physics.


Recommended Posts

--- Introduction ---

During the whole 1.1 slippery/explodey wheels, I began experimenting with alternatives to the buggy wheels. In particular, I began playing with skids made of I-beams and structural panels. I haven’t really seen skids in KSP before, and thus, had no idea how to make them. So, I began running through prototypes, testing all sorts of skid configurations, trying to find the lightest, most durable, and least draggy setup. Through this testing, I found something odd. One of my skid configurations did significantly better than all the others I tested:

Here is one of my standard skids:

wyWB89m.png

And here is the odd skid:

vyFeINt.png

As you can see, my standard skid only started moving when the engine thrust reached 18.7 Kn. By contrast, the other skid design started moving at about 13 Kn of thrust.

Can you spot the difference? The standard skid is resting on the flat side of skids, while the other skid is resting on the vertices of the skids.

In reality, between dry surfaces, friction does not depend on contact area. If you decrease contact area, you decrease the area for friction to act upon, but you also increase the pressure on the area. Turns out, this decrease of area is exactly canceled by the increased pressure. Thus, the force of static friction stays the same for a given mass, no matter how you vary the contact area. Most of the time. I’m sure there are cases where this isn’t true, but for the most part, it is a good approximation.

So, what’s going on here? Why does reducing the contact area appear to lower the static friction in KSP? Is there some sort of flaw in KSP’s friction system?

--- Building the test rigs ---

Curious, I began designing a series of test rigs to experiment with this phenomenon.  I wanted to eliminate as many external variables as possible, so I built the rigs to the following guidelines:

1.       Engine must be as close to the ground as possible to minimize torque

2.       CoM must be as close to the ground as possible to minimize torque

3.       Mass must stay constant

Here is what I came up with:

CvDtp8L.png

There are four structural panels on the bottom of the rig which can be angled to decrease contact area.

I then built two more variations of the rig.

One where only the edges of the panels contact the ground:

wAwoGCs.png

And one where only the vertices of the panels contact the ground:

YprfnaZ.png

All of the rigs have the same mass.

--- Running the tests ---

To perform the experiments, I will load each variation onto the runway, enable infinite fuel, throttle the engine until the rig starts accelerating, and then take note of the engine’s thrust. As of Newton’s third law, this force is equal to the force of static friction of the rig.

Now all we have to do is run the tests…

 

 

Wait a minute… What’s going on here? Why are the panels jittering everywhere? And why is it turning? Why does the speed keep changing? Sigh… This was going to be more difficult than I thought.

 

So, let’s, replace the 4 panels with just one panel. The mass stays the same, and contact area stays the same.

Success! Looks like the rig overcame static friction at 9.7 Kn. Let’s keep note of that number for the next tests.

Alright, now to test the edge contact area rig:

Huh, about 9.5 Kn again. So far, it looks like KSP is doing quite well.

Finally, let’s try the vertices contact area rig:

Would you look at that! It only took 4.8 Kn to overcome static friction, about half the force of other 2 tests.

 

--- Conclusion ---

For most cases, it seems that KSP handles the force of friction realistically. However, in cases where only the vertices of a part touch the ground, the force of friction is drastically reduced. Why is this? My guess is that since the plates are perfect shapes, their vertices essentially have an infinitely small contact area, confusing KSP’s friction calculation in some way. Then again, an edge of a perfect shape should also have an infinitely small surface area, and as you saw from my second test, the edges produced the same force of friction as the flat plate. So, at this point, I really have no idea what could be causing this.

And that isn’t to mention all of the other oddities I noticed during these tests. For example, the jittering plates in my first test. This jitter seems to increase with the number of parts touching the ground, but why? The parts are very sturdy: After all, they are steel plates fixed to a single steel beam and thus, they don’t move very much when put under pressure. Despite this, friction causes them to jitter, causing all sorts of random movements in the craft.

On top of all this, it seems friction on terrain differs significantly from friction on the runway! For one the static friction is much higher (Which makes sense, grass/dirt/sand would exert more friction than flat concrete). Additionally, the jittering is much, much worse on terrain. Parts will quite visibly jolt back and forth. However, this jittering will completely stop once the craft reaches a certain speed.  

--- Final Words ---

In the end, I am left with more questions than answers. While I did learn a little about how contact area effects friction in KSP, these experiments have revealed a bizarre world of KSP that I’ve never noticed before. A world where the simple act of sliding metal plates against a flat surface creates jittering, phantom forces, and physics-defying skids that glide effortlessly across the ground.

On that note, I want to encourage you all to help me explore KSP’s friction. Download my test rigs and try to replicate my results. Conduct your own experiments. Try testing parts other than structural panels. KSP’s friction is obviously much more complicated than it seems, so maybe with some group effort, we can come to understand how it actually works.

Thanks for reading everyone!

-Stratzenblitz75

Link to comment
Share on other sites

That's some good sciencing.

The terrain in KSP can induce all kinds of weird behaviour when craft are in contact with it. The way your panels flex in the second gif is a reasonable, but modest, example. Sometimes craft will shake, even to the point where they start "walking" around. More extreme examples will cause the joints on your ship to turn into wet noodles. A craft which is rigid while flying, or when sitting on wheels, landing gear or landings legs, can become very floppy when sitting directly on terrain without using any "designed to be sitting on the terrain" parts. In the most extreme example I found, I had heavy part (A) - which was the large RCS tank - sitting on i-beam (B), and I-beam (B) on the ground. When physics kicked in, part A started sliding around all over the top of the joint, and even translating up and down, clipping in and out of part B. Supporting the craft with a launch clamp, or putting any kind of "specially designed to touch terrain" part (landing gear) resolved the issue. This was, if I recall, during 0.90, I discovered this behaviour (and lots of other terrain weirdness) while playing around with mechs.

Link to comment
Share on other sites

2 minutes ago, allmhuran said:

That's some good sciencing.

The terrain in KSP can induce all kinds of weird behaviour when craft are in contact with it. The way your panels flex in the second gif is a reasonable, but modest, example. Sometimes craft will shake, even to the point where they start "walking" around. More extreme examples will cause the joints on your ship to turn into wet noodles. A craft which is rigid while flying, or when sitting on wheels, landing gear or landings legs, can become very floppy when sitting directly on terrain without using any "designed to be sitting on the terrain" parts. In the most extreme example I found, I had heavy part (A) - which was the large RCS tank - sitting on i-beam (B), and I-beam (B) on the ground. When physics kicked in, part A started sliding around all over the top of the joint, and even translating up and down, clipping in and out of part B. Supporting the craft with a launch clamp, or putting any kind of "specially designed to touch terrain" part (landing gear) resolved the issue. This was, if I recall, during 0.90, I discovered this behaviour (and lots of other terrain weirdness) while playing around with mechs.

Yep, I've encountered this annoying behavior as well. Take this rocket for example:

This thing masses at over 2000 tons, yet, its rotating and walking around the launchpad on its own.

However, when you remove the heat-sheilds on the bottom and let it rest on the MK2-3 fuel tank, it doesn't move at all. From this, it appears that the mass of the part(s) that contacts the ground plays a big part in what forces it experiences. A heavy object resting on a part with low mass will jitter and walk around, while a massive object resting directly on the ground won't. 

The more I think about it, the more I'm leaning towards stock-joints being the problem. If I recall correctly, the strength of the joint depends on the mass of the part, right? That would explain why a part with less mass would exhibit this behavior, while one with a large mass would not. I'm thinking that because the joint of a small mass part is weaker, it exacerbates some kind of bug in the stock-joint that causes the part to jitter when in contact with a force. 

Hmm... More experiments are definitely necessary. I wonder if this behavior still occurs when a part is resting on top of another stationary part instead of the ground? Is part-to-part friction different from part-to-ground friction?

Link to comment
Share on other sites

I'm purely hypothesizing, but the start/stop behaviour and spinning could be manifestations of the same effect.  Let's assume that the static friction is significantly higher than the kinetic friction.  Let's also assume that KSP joints wobble and are generally weird, which for anyone who's built anything like this, should be fairly well-known.  I'm imagining the following is happening:

As the vehicle moves, the forces on the various plates are rather high and change slightly due to inaccuracies in the simulation.  This, in turn, occasionally (heh) causes the joints to wobble, resulting in the plates all moving at different speeds relative to the ground.  Since the forces here are pretty large relative to the breaking strength of the joints, you get parts occasionally moving backwards at close to the speed that the vehicle is moving forwards for very short periods of time before the physics sim says that they're too far from their attachment point & there's now a force pushing them back into place.  During these periods of the plate being stationary relative to the ground, the game thinks the part's friction should use the coefficient of static friction, causing the force of friction to increase, in turn causing the part to "stick".  The parent part now needs to apply an even greater force than normal to move the part back into place, causing greater wobbles, and increasing the likelihood of the plate sticking again.  As well, this unusually high force isn't balanced out on the other side of the vehicle.  Since one plate will start to wobble before the others, and the plates aren't in exact alignment (as can be proven by looking in the .craft file; numbers being exactly the same between parts is rare even with symmetry), one plate will tend to "stick" more often, and the vessel spins.

When the vehicle spins far enough, the engine's now applying a force that's not directly opposing the force of friction, and the vehicle slows down.  This lets smaller wobbles cause sticking, increasing their likelihood, bringing the vehicle to a stop until the thrust vector is along the velocity vector again.  

 

Note that this is all purely conjecture, but it seems likely enough.  I'm not sure how we could test it, though.

Link to comment
Share on other sites

1 minute ago, Charlie_Zulu said:

I'm purely hypothesizing, but the start/stop behaviour and spinning could be manifestations of the same effect.  Let's assume that the static friction is significantly higher than the kinetic friction.  Let's also assume that KSP joints wobble and are generally weird, which for anyone who's built anything like this, should be fairly well-known.  I'm imagining the following is happening:

As the vehicle moves, the forces on the various plates are rather high and change slightly due to inaccuracies in the simulation.  This, in turn, occasionally (heh) causes the joints to wobble, resulting in the plates all moving at different speeds relative to the ground.  Since the forces here are pretty large relative to the breaking strength of the joints, you get parts occasionally moving backwards at close to the speed that the vehicle is moving forwards for very short periods of time before the physics sim says that they're too far from their attachment point & there's now a force pushing them back into place.  During these periods of the plate being stationary relative to the ground, the game thinks the part's friction should use the coefficient of static friction, causing the force of friction to increase, in turn causing the part to "stick".  The parent part now needs to apply an even greater force than normal to move the part back into place, causing greater wobbles, and increasing the likelihood of the plate sticking again.  As well, this unusually high force isn't balanced out on the other side of the vehicle.  Since one plate will start to wobble before the others, and the plates aren't in exact alignment (as can be proven by looking in the .craft file; numbers being exactly the same between parts is rare even with symmetry), one plate will tend to "stick" more often, and the vessel spins.

When the vehicle spins far enough, the engine's now applying a force that's not directly opposing the force of friction, and the vehicle slows down.  This lets smaller wobbles cause sticking, increasing their likelihood, bringing the vehicle to a stop until the thrust vector is along the velocity vector again.  

 

Note that this is all purely conjecture, but it seems likely enough.  I'm not sure how we could test it, though.

That's an interesting hypothesis, and some of my data seems to support it. For example, when the thruster is exerting a force slightly greater than static friction, I get the jittering behavior. In this case, the physics inaccuracies you talked about would cause the parts to randomly wobble slower than the craft, causing them to exert their static friction and "stick". When the craft reaches a certain speed, the jittering and random turning stops completely. In this case, the parts would be well within the realms of kinetic friction, and thus, random inaccuracies don't cause the parts to exert static friction.

Not sure how I'd test this either. I'd have to play around in game and experiment with this kinetic-static speed boundary. 

Link to comment
Share on other sites

I've used Unity 5 to create custom materials for my piston engines. Here's the documentation about "Physic Materials":

Quote

Friction is the quantity which prevents surfaces from sliding off each other. This value is critical when trying to stack objects. Friction comes in two forms, dynamic and static. Static friction is used when the object is lying still. It will prevent the object from starting to move. If a large enough force is applied to the object it will start moving. At this point Dynamic Friction will come into play. Dynamic Friction will now attempt to slow down the object while in contact with another.

When two bodies are in contact, bounciness and friction modes are applied individually to each agent. So, when body A has a friction combine mode of Average and body B has mode Multiply, then A is going to behave according to average parameters and B according to multiplied parameters.

Please note that the friction model used by the Nvidia PhysX engine is tuned for performance and stability of simulation, and does not necessarily present a close approximation of real-world physics. In particular, contact surfaces which are larger than a single point (such as two boxes resting on each other) will be calculated as having two contact points, and will have friction forces twice as big as they would in real world physics. You may want to multiply your friction coefficients by 0.5 to get more realistic results in such a case.

 

Link to comment
Share on other sites

This is an interesting set of findings, though some of the descriptions in the original post don't fully comport with what I remember from undergraduate Engineering Statics. That said, it's been 30 years since I took that class so I'm inclined not to sweat it.

Has anyone tested the .craft file in the first post with KJR installed? I'm curious if Ferram's tweaks to joint physics affects the results.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...