Jump to content

Rapid unplanned disassembly issue


Recommended Posts

I'm currently trying to build a part that can deploy an energy shield. After a few iterations, I've gotten as far as creating an energy shield with a fair bit of success, the biggest issue at the moment is that if the shield doesn't start turned on, the craft will perform rapid disassembly upon being turned on. If it starts turned on I can turn it on/off as I wish, but it seems like when it gets turned on it is subjected to odd physics effects and rips the vessel apart.

Currently, I have a model (.mu) that consists of a transparent model and a collider that is a hollow sphere. The .cfg file reference the model for the mini ISRU (which is what I'm using for the part model) and the sphere shield .mu. I've also got 2 sets of drag cubes, one for when the shield is active and one for when it's inactive. To turn the shield on/off I simply mark the game object that has the shield model & collider active/inactive and adjust the drag cube weighting (the ship tears itself apart regardless of if I adjust the drag cube weighting). I'll eventually have to work on marking objects shielded/unshielded I think, but I'm not 100% sure on that.

Thus far, I've tried initializing the shield in OnAwake, OnInitialize, and having now been doing it in FixedUpdate with a boolean flag to indicate when the shield state needs updated. Regardless of where I do it, the ship will explode when the shield is turned on if it started in the off state.

I've also tried adjusting the shield gameobject to several different positions after examining the locations of other gameobjects on the part using KOI and thinking that if I matched them it might balance out the physics forces. I've also tried calling part.update() as I seem to recall that there may be something I need to do to tell the KSP engine that a part has changed. Any ideas on what might be causing a part that gets a collider added to it to tear itself apart or something else I might be doing that would cause it?

Link to comment
Share on other sites

There is a special call that needs to happen in order to inform KSP to ignore same-vessel-collisions for specific colliders.

I think it is something like --
            part.ScheduleSetCollisionIgnores();

or
            part.SetCollisionIgnores();


Errr... perhaps it is actually this that I was thinking of (used in KSPWheel):

CollisionManager.IgnoreCollidersOnVessel(vessel, newCollider);

Either way; yes, you are correct; you need to inform the KSP engine that new colliders are present and that the same-vessel collision ignores need to be updated.

Link to comment
Share on other sites

4 hours ago, Shadowmage said:

There is a special call that needs to happen in order to inform KSP to ignore same-vessel-collisions for specific colliders.

I think it is something like --
            part.ScheduleSetCollisionIgnores();

or
            part.SetCollisionIgnores();


Errr... perhaps it is actually this that I was thinking of (used in KSPWheel):


CollisionManager.IgnoreCollidersOnVessel(vessel, newCollider);

Either way; yes, you are correct; you need to inform the KSP engine that new colliders are present and that the same-vessel collision ignores need to be updated.

Yay! You fixed it! ^_^

 

It was the CollisionManager, though I'm not certain why. I'd specifically made the sphere collide hollow. I'm going to assume something was lost in translation with unity and that despite my best effort, it is in fact not hollow as intended.

Thank you!

Edited by Darinth
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...