Jump to content

How would I calculate how much stress a part is enduring?


Recommended Posts

Im trying to figure out what forces are in play that causes parts to break and bend in code format.

I have Isolated each parts already, I know how to grab the BreakingForce and Torque limits but I cant figure out what I need to get the amount of stress there is for specific part

The plan is to add soundeffects for each part that is being stressed so you can "hear" which part is having it worst. And at very high stresses where parts will actually break, I would play a sound that would correspond to the situation.

This is for the mod Im working on in This Thread


foreach (Part part in vessel.parts) {
if(part.physicalSignificance == Part.PhysicalSignificance.FULL)
{
//whattodohere
}
}

Edited by ensou04
Link to comment
Share on other sites

You can't get the current stress applied to a joint and you can't know the acceleration applied to each part, so I don't really see how you can get the stress :(

Yeah thats what I found out, because most members inside the Part class are constants and some are just universal like the angular velocity and drag.

So there is really no way? how does the game handle joint breaks though?

Link to comment
Share on other sites

The game define Unity Joint and set their breaking force and torque. They are handled by the Unity physic engine and you don't get to see the internal values (AFAIK).

You can get the Joint class used by searching the part gameobject component (The Kerbal Joint Reinforcement mod code can show you how to do that) but you can only set limits there. The game when a joint break with the OnJointBreak message, that provides the break force.

Link to comment
Share on other sites

The game define Unity Joint and set their breaking force and torque. They are handled by the Unity physic engine and you don't get to see the internal values (AFAIK).

You can get the Joint class used by searching the part gameobject component (The Kerbal Joint Reinforcement mod code can show you how to do that) but you can only set limits there. The game when a joint break with the OnJointBreak message, that provides the break force.

You're right, theres no way to know the internal values. and alot of stuff is hidden within KSP itself. I guess there really isnt anyway to know the acceleration per part.

Thank you for explaining it to me :D

My last resort actually is just use FAR, I think somewhere inside FAR is a code that breaks joints and I Guess I could do something about it to do what I want to achieve

Edited by ensou04
Link to comment
Share on other sites

  • 10 months later...

I'm curious about this as well. I build some large structures and if I have a lot of repeating parts it is difficult to know which parts have broken from the F3 event list, (for example dropping submarine crafts onto the water surface can be an exercise in frustration).

Perhaps if you can't display which parts are getting stressed maybe an add on could be created that pauses the game when one joint breaks and highlights the affected parts in colour? That would be a God send. :)

Edited by Redshift OTF
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...