Jump to content

How to change PhysicsSignificance from a PartModule in the VAB


Recommended Posts

Because of some NodeRotate issues, I need to activate PhysicsSignificance on some physicsless parts, so that they stay physically significant when launched. Apparently I can't make it work in flight, so I was thinking to make it in the VAB/SPH. Any suggestions on how to make it?

Edited by peteletroll
added mod link
Link to comment
Share on other sites

Try PartModule.part.physicalSignificance = PhysicalSignificance.FULL;

https://kerbalspaceprogram.com/api/class_part.html#a3b1b97fd1e60e0bdf2b116840827ea8d

You might also have to change PartModule.part.PhysicsSignificance to a different value. 

I'm not sure if the values will carry through to flight, but they should. 

Link to comment
Share on other sites

Thanks @Benjamin Kerman, further investigation found out that PhysicsSignificance is never specified in the .craft file. I'm afraid I have a problem now :P

(clarification: if it's not in the .craft file there's nothing I can do in the VAB/SPH)

Edited by peteletroll
clarification
Link to comment
Share on other sites

8 hours ago, peteletroll said:

Thanks @Benjamin Kerman, further investigation found out that PhysicsSignificance is never specified in the .craft file. I'm afraid I have a problem now :P

(clarification: if it's not in the .craft file there's nothing I can do in the VAB/SPH)

You should be able to edit the prefab in the editor but the values may not carry over on scene load

Another thing you could do is have a monobehaviour that checks each part of a vessel on flightscene load and if the physics is off on a part it turns it on

 

Link to comment
Share on other sites

  • 3 weeks later...

I think setting the value for the Available Part prefab to should work. (0 is full, 1 is none).

part.partInfo.partPrefab.PhysicsSignificance = 0;

That should make any new copies of the part, anything that is spawned in the editor after making that change or anything that is loaded in flight, behave as a normal part.

There is also part.PromoteToPhysicalPart(), you might have to call that on the available part prefab before it works right.

Link to comment
Share on other sites

  • 4 weeks later...
On 8/3/2018 at 10:49 PM, DMagic said:

There is also part.PromoteToPhysicalPart(), you might have to call that on the available part prefab before it works right.

@DMagic, I tried PromoteToPhysicalPart() in flight, but the part detaches from the vessel in a weird way: it falls on the ground, but as soon as i time warp it jumps back into position; then I stop warping and it falls again... Could you please be a little more specific about PromoteToPhysicalPart() usage? I googled a lot, but I wasn't able to find any understandable example... :(

Link to comment
Share on other sites

  • 2 months later...

Found out how to activate physics in flight: after PromoteToPhysicalPart() you have to create a PartJoint to the parent part explicitly. This works when the parent part is physicsless too.

See the forcePhysics() function code for details.

Edited by peteletroll
Better forcePhysics() implementation
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...