Jump to content

Hide parts from physics


Recommended Posts

Hello.

I was wondering if it were possible to have parts inside a cargo bay or fairing be 'hidden' from physics calculations.

For example, imagine I have a 150 part shuttle. 100 parts belong to the shuttle. 50 parts belong to the cargo bay payload. How do I write a mod that prevents physics calculations from being applied to those 50 'hidden' parts? Basically, the craft, in the eyes of the game, becomes a 100 part craft, with the entire cargo bay contents being just 1 physics-less part. When the cargobay opens, it revenrts to being calculated as 150 parts.

One phenomenon you may see is very long payloads swaying inside long fairings. Can the same as above be applied here?

Link to comment
Share on other sites

  • 2 weeks later...
You'd need to write a module that detected stowed parts and made their rigidbody's kinematic (last time I checked that was the best way to disable physics on a part).

By writing a module, you mean learning C# and writing a dll?

Link to comment
Share on other sites

Here you go, I've not tested it yet, but the people on the modders irc think it looks good. Give me any feedback, if it works well I'll make a proper thread for the mod.

http://www./download/j3332b6xw96hphi/Stowed_Physics_Disabler.zip

tumblr_m6odkq8jNo1qbolbn.gif

This could be THE next solution to high-part count spaceships. This and that part-welding mod that hasn't updated to 1.0.2 yet.

PS: A modder IRC? Interesting.

Link to comment
Share on other sites

I take it to be a success?

I've been looking into something similar-ish to this for merging large chunks of structure, like the 1x1 and 2x2 armor plates. I've currently nicknamed the idea "Physics-Weld" and it would work by merging the component on a part that handles physics (called a rigidbody) into one component for a group of parts, so that the physics would be calculated on a group scale rather than a individual scale.

The modder irc is "#kspmodders", you can access it from kiwiirc (same client as the #kspofficial link on the top of the forums) or on "webchat.esper.net".

Link to comment
Share on other sites

I take it to be a success?

I've been looking into something similar-ish to this for merging large chunks of structure, like the 1x1 and 2x2 armor plates. I've currently nicknamed the idea "Physics-Weld" and it would work by merging the component on a part that handles physics (called a rigidbody) into one component for a group of parts, so that the physics would be calculated on a group scale rather than a individual scale.

The modder irc is "#kspmodders", you can access it from kiwiirc (same client as the #kspofficial link on the top of the forums) or on "webchat.esper.net".

I'm sorry :/

Either it did not work, or it did not have the intended effect.

I built a 227 part plane, containing about 211 parts inside MK2 cargo bays.

Normally, it would lag like a 227 part plane when the cargobay is open, but fly like a 15 part plane when the cargobays are closed.

Results: 134 fps when viewing the space center. 15 fps in the SPH. 12 fps in flight (cargo bay open) and 12 fps with the cargobay closed. More interestingly, the fps seemed to slow down over time, but that might just be flight behaviour.

Imgur album:

Javascript is disabled. View full album
Edited by TruthQuark
Link to comment
Share on other sites

I would use this so long as the weight of the stuff in storage was added to the weight of the container when the container is closed.

Also, it would be good to have the center of mass of the container be calculated based on what was stored in the container.

Link to comment
Share on other sites

Doing what that code does is a bad idea that will break other mods.

I... well, I haven't seen it do anything so far.

Matrixmage, does it only work under specific conditions? I continued testing by launching a craft with cargobay closed or open, and it has no effect on the contents of the cargobay for the moment...

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