Jump to content

Disable physics on "background scenery" ships


Wanderfound

Recommended Posts

I'm putting together a ridiculously elaborate setup for the Minmus Iceracing Championships.

So far, I've got two pair of giant vertical SSTO's functioning as the start/finish line marker posts, some grandstands to hold about a hundred Kerbals, and a dozen iceracing spaceplanes parked in the background.

Unsurprisingly, this is making my laptop cry; all of these ships are 100+ parts each.

Is there any way to disable physics on the parked ships? Something that would just turn them into immobile bits of scenery without bothering my computer with a squillion irrelevant physics calculations? Preferably temporarily, but it's Sandbox so they don't absolutely need to be flyable again. What about something that lets you set up a persistent "ghost" image of a ship, so I could put them in place and then fly the real ships back out of physics range?

Something like this would make setting up elaborate cinematics a lot easier, and might also have some application in reducing the physics lag when approaching a crowded space station.

Does such a thing already exist? If not, how feasible is it to create something like this?

Edited by Wanderfound
Link to comment
Share on other sites

Related: is there some way to tweak the physics range parameter? Make it so that it only does physics within 100m or so?

I know there is because mods have extended it. I don't know how exactly. That would probably work better than trying to force crafts to go on rails.

EDIT: looks like the "Vessel" class has some parameters for determining pack/unpack:

float distancePackThreshold

float distanceLandedPackThreshold

float distanceUnpackThreshold

float distanceLandedUnpackThreshold

I don't have time right now to fiddle with this, so I can't do any tests to see how this could work.

Edited by Xaiier
Link to comment
Share on other sites

Just an aside, if you decrease the physics range to 100m and your granstands are over 100m away, they won't show up at all so there's no point in them being there.

You could, however, use that part welding mod to make the things one part which would ease the physics calculations immensely.

No, there's a difference between loaded range and packed range. Packed is like being on rails.

EDIT:

float distancePackThreshold = 5000

float distanceLandedPackThreshold = 350

float distanceUnpackThreshold = 200

float distanceLandedUnpackThreshold = 200

What this means is that if you go out past 350m from your other things, they will go into the packed state and physics calculations will be skipped, and you can then come in to 200m before it gets re-enabled. If that isn't enough, modding will be required to modify the values.

Edited by Xaiier
Link to comment
Share on other sites

  • 5 months later...

I had to look into this on my stanford torus mod but to enable physics instead of disable them. From above the parameters you need were listed:

float distancePackThreshold = 5000

float distanceLandedPackThreshold = 350

float distanceUnpackThreshold = 200

float distanceLandedUnpackThreshold = 200

These are present on every ship and are in meters. It should be noted that the game world coordinates literally revolve around your current ship: Your ship's position is the origin so you can calculate ship distances directly through the Vector3 distance function. You won't need that for this though.

Those variables go like this:

Pack Thresholds are when the ship goes from off-rails to on-rails. This is in meters distance from your current ship. A ship being on rails will still render up to 2.3 km away. That's a different parameter (I don't recall it off the top of my head).

Unpack thresholds are when the ship goes from on rails to off rails.

You'll need to put a module on your vessel that when it does its Update() routine checks every vessel and updates these values to the ones you want. You can filter it to vessels in the general vicinity through that vector 3 thing I mentioned or just check all of them. The landed ones are new to me but I suspect they're not much different. In the source for my stanford torus mod is a module called "structuralIntegrityField" which will show you what to do.

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