Jump to content

scale and units in KSP; physics tweeks


Recommended Posts

I'm trying to write a plugin that modifies physics to make rockets less wobbly. I was able to successfully replace the default joint with one of my own creation, but the behavior is... off. I believe the issue is one of scale.

I'm currently working under the assumption that:

1 unit of mass == 1 metric tonne

1 unit distance == 1 meter

But that doesn't appear to be working. Is that incorrect, or do I have an issue elsewhere?

Link to comment
Share on other sites

Alright, I ripped the model of the FL-400 fuel tank out of the MU format and it appears the scale is 1 unit = 1.25 meters. That's still not enough to account for the problems I'm having. Forces are all in kN? And pressure is then 1 unit force / 1 square unit distance, or .640 kPa?

Link to comment
Share on other sites

I believe a some of the wobble is caused by imprecision rather than actual forces, if you run a search for wobbly joints in the unity engine generally then the solution is usually to turn up the calculation precision rather than rescaling for appropriate forces.

Link to comment
Share on other sites

Any idea how one might do that? I don't think it's one of the parameters on the joint. What bothers me most is the oscillations when using an autopilot mod like mechjeb with a large rocket; gets nasty real quick, and 2/3 of the rocket ends up as space tape. I did find a dampening parameter that I can modify, and it did seem to help. There's still the issue where rockets aren't "stiff" enough, so what I'm trying to do is make it so that they can handle the same amount of load, but deform much less before breaking; it's proved to be very finicky.

Link to comment
Share on other sites

One of the most effective ways to reduce rigidbody wobble in Unity is to add more joints between the rigidbodies. It's like adding more screws to the connection between two pieces of wood minus the orientation and volume requirements caused by the wood and screws (Unity joints can be way off in space but still connecting two objects, and you can have two joints infinitesimally close to each other).

Link to comment
Share on other sites

I haven't given up on this, but it's tedious beyond words to reload KSP every time I make a tweak. I need to figure out how to add a debug GUI so I can tweak the joints without a reload. I also need to make it so this works on the whole ship rather than as a part module. Nothing new or complicated there. I'll update on progress sometime later; I'm modeling some simple parts at the same time, so it's slow going.

Link to comment
Share on other sites

  • 1 month later...

FireStorm are you still working on this? Because I wanted to do something like this myself, and I'd like to help you or at least discuss the progress you made, so that I can take over from there

Link to comment
Share on other sites

Hat's off to anyone willing to try fixing the stupid wobbly connections. Just sign this release form, insurance card, blood type, organ donor card, next of kin, living will, preferred institution for commitment, burial instructions, and you're good to mod.

Here is where I left off, feel free to use/ignore anything there. The issue was temporarily solved in 0.17, but broke immediately when we got the fubar docking code, and I couldn't fix it without breaking the EULA, or doing insane things with Unity directly.

Basically, the rockets are wobbly because Harv decided way back that it was just too hard to set up configurable joints properly(which are very poorly documented), and opted instead to use the quick and easy fixed joint, which is basically intended for stuff like making spitballs adhere to walls, not holding a rocket together.

You don't necessarily have to use configurable joints to fix it, though that's what I did, the surface connections are/were hinge joints, which is why they don't wobble in quite the same manner. Settings like the physics iteration rate were hidden far beyond the layer of code we had access to with plugins back when I left, and I doubt you'll have much luck now, unless you manage to talk directly to Unity in the game scene, and get them to stick. A very serious problem I had was that fixing the wobble, and thereby making rockets an actual (mostly) rigid body, broke the terrain collision code; apparently, it actually relies on the wobblyness to compensate for it's inability to actually simulate terrain collision.

To directly answer your original question: there is no answer. The physics engine Unity uses has a basic limit of around 10 for mass values. Obviously, 10kg parts means a very small rocket. Harv's solution way back when was to use mass units of "tons", or kilo-kilo-grams, and thrust(force) units of kilo-newtons, which together cancel out the extra "kilo" when calculating acceleration.

I'm assuming you're asking about atmospheric pressures. Through testing(back in 0.17), I figured out the atmospheric model was basically using constant-temperature pressures equal to Earth std atmospheres. In absolute units, they convert to pascals the same way Earth atmospheres do, just remember the temperature is always 60F when using the gas laws.

So:

1 KerboGram = 1000 kg

1 KerboMeter = 1 m

1 KerboSecond = 1 s

1 KerboForce = 1000 kN

1 KerboPressure = 1 atm = 101325 Pa

and it's always a chilly 60F outside.

The problem is that through testing gravity, I found out Harv still has/had the planets using masses in kg, which causes a very bogus big G, and throws the whole physics thing out the window. You don't notice it as much in game, because it's all specifically normalized to have the surface of Kerbin be the same as the surface of Earth, but if you dig at all, it falls apart fast. However, as long as you're only using Force + Mass -> Acceleration, the failure to scale length and time appropriately won't bother you too much.

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...