Kerbal Inventory System (KIS)

Kerbal Inventory System (KIS)

1M Downloads

Part explosion when dropped on ground

KospY opened this issue ยท 16 comments

commented

Part can explode when dropped on ground.

commented

I have something similar with the connectors that are dropped detached when loading a quicksave if I then pick up those dropped parts then they explode

commented

I noticed that only very small parts have that behavior.

commented

It happens with solar panels & batteries in my experience.

commented

The physicsless parts?

commented

Also happens with antennas and thermometers. I've seen other physics-less parts survive falls however. My experience with this phenomena was in Munar gravity.

commented

You can't do anything about it, it's a game issue which lies in the small-big collider interaction. Even without KIS installed if you somehow drop these parts on the ground they explode. Just avoid dropping small parts on the ground and if you have to - use the "b" "n" buttons to give some distance between the part and the ground. Maybe update to Unity 5 will fix this.

commented

Can we temporarily add bigger colliders to small parts when they become root parts?

commented

colliders are made when an item is modelled in a 3D program, they all have their own names given by the author, so there's probably no way to tweak them all in bulk.

commented

AFIK you can create colliders at run time:

// assuming you got a reference to part's GameObject and stored it in partGameObject
SphereCollider sc = partGameObject.AddComponent<SphereCollider>()
sc.radius = 0.5f;

So it is possible. I'm asking how good / bad this solution is.

commented

This will mean that if you detach a small part using "H" button, it will suddenly gain a big collider which will collide with the parent vessel sending the part flying away from the vessel or destroying it.

  1. I heard about a layer based collision detection and it looks like it's technically possible to "add" a layer programmatically (just by picking a number bigger than any existing layer number, but lesser than 32). The problem is: it looks like there is no way to notify other mods about it. This might cause conflicts if other modes "add" their own layers too. Though the layer based will only help if planets and parts are in different layers.
  2. Another option would be to add a bigger trigger collider, that in OnTriggerEnter disables collisions with parts:
void OnTriggerEnter (Collider other) {
    if (IsPart(other.gameObject)) {  // I don't know how to check if an object is a part (or it's child), but I'm sure there should be a way
        Physics.IgnoreCollision(collider, other);
    }
}
commented

Another option would be to make small parts hover above ground by adding a force based on raycast distance.

commented

This will mean that if you detach a small part using "H" button, it will suddenly gain a big collider which will collide with the parent vessel sending the part flying away from the vessel or destroying it.

commented

Currently this is a problem - the large fixed radiators already qualify as "small parts that explode". Let's see if 1.2 makes it better.

commented

It's a KSP feature with small parts, so less parts are scattered around when you crash. Drop your small parts on other parts to avoid explosions.

commented

My tests shown that issue is in how ColliderEnhancer works. It destroys a part if it gets accelereted with too high force (Unity doesn't do it normally). When a part is dropped on the surface it may colide with it, and collider will push the part out of the body. Depending on the body gravity force and value of the collision error the part may get accelered beyond the safe limit. That's why parts usually explode on Minmus, less frequently on Mun, and almost never on Kerbin.

There is a way to avoid explosion: calculate drop point so what no collision with the surface happens. Though, finding the right point is a much more challenging task than one may guess. As for now there are no plans to fix the issue, sorry.

WORKAROUND. Drop on the surface a part with trivial geometry (e.g. a structural panel), then attach to it all the parts you were going to drop. Do not drop them since it will result in the same behavior. By attaching you disable colliders between the parts since they become a single vessel, parts from the different vessels will collide with all the bad consequences.

commented

For now it's infeasible to fix it for a generic case.