DebugLog() публичный статический Метод

public static DebugLog ( string format ) : void
format string
Результат void
Пример #1
0
        public static void AddNodeTransform(Part p, AttachNode attachNode)
        {
            Quaternion rotation = Quaternion.LookRotation(attachNode.orientation, Vector3.up);

            if (attachNode.nodeType == AttachNode.NodeType.Surface)
            {
                rotation = Quaternion.Inverse(rotation);
            }

            if (attachNode.nodeTransform == null)
            {
                Transform nodeTransform = new GameObject("KASNodeTransf").transform;
                nodeTransform.parent        = p.transform;
                nodeTransform.localPosition = attachNode.position;
                nodeTransform.localRotation = rotation;
                attachNode.nodeTransform    = nodeTransform;
            }
            else
            {
                attachNode.nodeTransform.localPosition = attachNode.position;
                attachNode.nodeTransform.localRotation = rotation;
                KAS_Shared.DebugLog("AddTransformToAttachNode - Node : " + attachNode.id
                                    + " already have a nodeTransform, only update");
            }
        }
Пример #2
0
        public override void OnPartUnpack()
        {
            base.OnPartUnpack();

            if (grabbed)
            {
                if (!evaHolderPart)
                {
                    if (evaHolderVesselName != null && evaHolderVesselName != "")
                    {
                        Vessel vess = KAS_Shared.GetVesselByName(evaHolderVesselName);
                        if (vess)
                        {
                            KAS_Shared.DebugLog("OnPartUnpack(EvaGrab) - Re-set grab after load on : " + evaHolderVesselName);
                            Grab(vess);
                        }
                        else
                        {
                            GameEvents.onCrewBoardVessel.Remove(new EventData <GameEvents.FromToAction <Part, Part> > .OnEvent(this.OnCrewBoardVessel));
                            evaHolderVesselName = null;
                            evaHolderPart       = null;
                            grabbed             = false;
                        }
                    }
                }
                else if (grab_pending)
                {
                    grabbed = false;
                    Grab(this.vessel);
                    grab_pending = false;
                }
            }
        }
Пример #3
0
        private IEnumerator WaitAndSendMsg(Part partToAttach, Vector3 position, Quaternion rotation, Part toPart = null)
        {
            while (!partToAttach.rigidbody)
            {
                KAS_Shared.DebugLog("WaitAndAttach(Pointer) - Waiting rigidbody to initialize...");
                yield return(new WaitForFixedUpdate());
            }
            if (toPart)
            {
                KAS_Shared.DebugLog("WaitAndAttach(Pointer) - Rigidbody initialized, setting velocity...");
                partToAttach.rigidbody.velocity        = toPart.rigidbody.velocity;
                partToAttach.rigidbody.angularVelocity = toPart.rigidbody.angularVelocity;
                KAS_Shared.DebugLog("WaitAndAttach(Pointer) - Waiting velocity to apply by waiting 0.1 seconds...");
                yield return(new WaitForSeconds(0.1f));

                partToAttach.transform.position = position;
                partToAttach.transform.rotation = rotation;
                partToAttach.SendMessage("OnAttachPart", toPart, SendMessageOptions.DontRequireReceiver);
            }
            else
            {
                partToAttach.transform.position = position;
                partToAttach.transform.rotation = rotation;
                partToAttach.SendMessage("OnAttachStatic", SendMessageOptions.DontRequireReceiver);
            }
        }
Пример #4
0
        private void MotorGoTo(float angle)
        {
            KAS_Shared.DebugLog("MotorGoTo(Rotor) - Go to angle : " + angle);
            if (!KAS_Shared.RequestPower(this.part, powerDrain))
            {
                return;
            }

            fxSndMotorStart.audio.Play();
            if (!fxSndMotor.audio.isPlaying)
            {
                fxSndMotor.audio.Play();
            }
            rotorGoingTo = true;

            hingeJnt.useSpring = true;
            hingeJnt.useMotor  = false;
            hingeJnt.useLimits = hasLimit;
            rotorActivated     = true;

            JointSpring spr = new JointSpring();

            spr.spring         = spring;
            spr.targetPosition = angle;
            spr.damper         = damper;
            hingeJnt.spring    = spr;
        }
Пример #5
0
 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     if (node.HasNode("FIXEDATTACH"))
     {
         ConfigNode FxNode = node.GetNode("FIXEDATTACH");
         KAS_Shared.DebugLog("OnLoad(Core) Loading fixed joint info from save...");
         FixedAttach.savedPartID     = FxNode.GetValue("connectedPartID").ToString();
         FixedAttach.savedVesselID   = FxNode.GetValue("connectedVesselID").ToString();
         FixedAttach.savedBreakForce = float.Parse(FxNode.GetValue("breakForce"));
         attachMode.FixedJoint       = true;
     }
     if (node.HasNode("DOCKEDVESSEL") && node.HasValue("dockedPartID"))
     {
         KAS_Shared.DebugLog("OnLoad(Core) Loading docked info from save...");
         this.vesselInfo = new DockedVesselInfo();
         this.vesselInfo.Load(node.GetNode("DOCKEDVESSEL"));
         dockedPartID      = node.GetValue("dockedPartID").ToString();
         attachMode.Docked = true;
     }
     if (node.HasValue("StaticJoint"))
     {
         attachMode.StaticJoint = true;
     }
 }
Пример #6
0
 public void OnPartUnpack()
 {
     if (grabbed)
     {
         if (!evaHolderPart)
         {
             if (evaHolderVesselName != null && evaHolderVesselName != "")
             {
                 Vessel vess = KAS_Shared.GetVesselByName(evaHolderVesselName);
                 if (vess)
                 {
                     KAS_Shared.DebugLog("OnPartUnpack(EvaGrab) - Re-set grab after load on : " + evaHolderVesselName);
                     Grab(vess);
                 }
                 else
                 {
                     evaHolderVesselName = null;
                     evaHolderPart       = null;
                     grabbed             = false;
                 }
             }
         }
         else
         {
             if (!physicJoint)
             {
                 this.part.rigidbody.isKinematic = true;
             }
         }
     }
 }
Пример #7
0
        public void AttachStatic(float breakForce = 10)
        {
            KAS_Shared.DebugLog("JointToStatic(Base) Create kinematic rigidbody");
            if (StaticAttach.connectedGameObject)
            {
                Destroy(StaticAttach.connectedGameObject);
            }
            GameObject obj = new GameObject("KASBody");

            obj.AddComponent <Rigidbody>();
            obj.rigidbody.isKinematic        = true;
            obj.transform.position           = this.part.transform.position;
            obj.transform.rotation           = this.part.transform.rotation;
            StaticAttach.connectedGameObject = obj;

            KAS_Shared.DebugLog("JointToStatic(Base) Create fixed joint on the kinematic rigidbody");
            if (StaticAttach.fixedJoint)
            {
                Destroy(StaticAttach.fixedJoint);
            }
            FixedJoint CurJoint = this.part.gameObject.AddComponent <FixedJoint>();

            CurJoint.breakForce     = breakForce;
            CurJoint.breakTorque    = breakForce;
            CurJoint.connectedBody  = obj.rigidbody;
            StaticAttach.fixedJoint = CurJoint;
            attachMode.StaticJoint  = true;
        }
Пример #8
0
 public void RefreshCtrlState()
 {
     KAS_Shared.DebugLog("RefreshCtrlState(Rotor)");
     if (controlActivated)
     {
         if (controlInverted)
         {
             controlField = "Enabled(Inverted)";
         }
         else
         {
             controlField = "Enabled";
         }
     }
     else
     {
         if (controlInverted)
         {
             controlField = "Disabled(Inverted)";
         }
         else
         {
             controlField = "Disabled";
         }
     }
 }
Пример #9
0
        public void AttachFixed(Part srcPart, Part tgtPart, float breakForce)
        {
            attachMode.FixedJoint = true;
            FixedAttach.srcPart   = srcPart;
            FixedAttach.tgtPart   = tgtPart;

            if (!srcPart.packed && !tgtPart.packed)
            {
                KAS_Shared.DebugLog("AttachFixed(Core) Create fixed joint on " + srcPart.partInfo.title
                                    + " with " + tgtPart.partInfo.title);
                if (FixedAttach.fixedJoint)
                {
                    Destroy(FixedAttach.fixedJoint);
                }
                FixedAttach.fixedJoint = srcPart.gameObject.AddComponent <FixedJoint>();
                FixedAttach.fixedJoint.connectedBody = tgtPart.rb;
                FixedAttach.fixedJoint.breakForce    = breakForce;
                FixedAttach.fixedJoint.breakTorque   = breakForce;
            }
            else
            {
                SetCreateJointOnUnpack(true);
                KAS_Shared.DebugWarning("AttachFixed(Core) Cannot create fixed joint as part(s) is packed,"
                                        + " delaying to unpack...");
            }
        }
Пример #10
0
 /// <summary>Starts physics handling on the object.</summary>
 /// <remarks>The object is expected to not have rigidbody. The one will be added with the proper
 /// mass and velocity settings. Parent transform of the physics object will be set top
 /// <c>null</c>, and it will become an idependent object.</remarks>
 /// <param name="physicObj">Game object to attach physics to. In normal case it's never a part's
 /// gameobject.</param>
 /// <param name="mass">Mass of the rigidbody.</param>
 /// <param name="delayPhysics">If default or <c>false</c> then new object gets parent's velocity
 /// immediately. Otherwise, the rigidbody is created as kinematic and velocity is sync'ed in the
 /// next <c>FixedUpdate()</c> call.</param>
 public void StartPhysics(GameObject physicObj, float mass, bool delayPhysics = false)
 {
     KAS_Shared.DebugLog("StartPhysics(PhysicChild)");
     if (this.physicObj == null)
     {
         this.physicObj         = physicObj;
         physicObjRb            = physicObj.AddComponent <Rigidbody>();
         physicObjRb.mass       = mass;
         physicObjRb.useGravity = false;
         if (delayPhysics)
         {
             physicObjRb.isKinematic = true;
             StartCoroutine(WaitAndPromoteToPhysic());
         }
         else
         {
             physicObjRb.velocity        = part.Rigidbody.velocity;
             physicObjRb.angularVelocity = part.Rigidbody.angularVelocity;
             physicObj.transform.parent  = null;
         }
     }
     else
     {
         KAS_Shared.DebugWarning("StartPhysics(PhysicChild) Physic already started! Ignore.");
     }
 }
Пример #11
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }

            Events["ContextMenuRetract"].guiName = "Retract (" + KASAddonControlKey.telescopicRetractKey + ")";
            Events["ContextMenuExtend"].guiName  = "Extend (" + KASAddonControlKey.telescopicExtendKey + ")";

            KAS_Shared.createFXSound(this.part, fxSndMotorStart, motorStartSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndMotor, motorSndPath, true);
            KAS_Shared.createFXSound(this.part, fxSndMotorStop, motorStopSndPath, false);
            KAS_Shared.createFXSound(this.part, fxSndSection, sectionSndPath, false);

            LoadSections();

            if (savedSectionsLocalPos.Count > 0)
            {
                KAS_Shared.DebugLog("OnStart(TelescopicArm) - Re-set section position from save");
                foreach (KeyValuePair <int, SectionInfo> section in sections)
                {
                    KAS_Shared.DebugLog("OnStart(TelescopicArm) - Move section " + section.Key + " to local position : " + section.Value.savedLocalPos);
                    section.Value.transform.position = this.part.transform.TransformPoint(section.Value.savedLocalPos);
                }
            }
        }
Пример #12
0
 private void UpdateAttachControl()
 {
     if (KASAddonPointer.isRunning)
     {
         if (
             Input.GetKeyDown(KeyCode.Escape) ||
             Input.GetKeyDown(KeyCode.Space) ||
             Input.GetKeyDown(KeyCode.Mouse1) ||
             Input.GetKeyDown(KeyCode.Mouse2) ||
             Input.GetKeyDown(KeyCode.Return) ||
             Input.GetKeyDown(attachKey.ToLower())
             )
         {
             KAS_Shared.DebugLog("Cancel key pressed, stop eva attach mode");
             KASAddonPointer.StopPointer();
         }
     }
     else if (Input.GetKeyDown(attachKey.ToLower()))
     {
         KASModuleGrab grabbedModule = KAS_Shared.GetGrabbedPartModule(FlightGlobals.ActiveVessel);
         if (grabbedModule)
         {
             if (grabbedModule.attachOnPart || grabbedModule.attachOnEva || grabbedModule.attachOnStatic)
             {
                 KASAddonPointer.StartPointer(grabbedModule.part, KASAddonPointer.PointerMode.MoveAndAttach, grabbedModule.attachOnPart, grabbedModule.attachOnEva, grabbedModule.attachOnStatic, grabbedModule.attachMaxDist, grabbedModule.part.transform, grabbedModule.attachSendMsgOnly);
             }
         }
     }
 }
Пример #13
0
 /// <summary>Overriden from MonoBehavior.</summary>
 void OnDestroy()
 {
     KAS_Shared.DebugLog("OnDestroy(PhysicChild)");
     if (physicObjRb != null)
     {
         StopPhysics();
     }
 }
Пример #14
0
 public virtual void OnPartUnpack()
 {
     if (attachMode.StaticJoint)
     {
         KAS_Shared.DebugLog("OnVesselGoOffRails(Core) Re-attach static object");
         AttachStatic();
     }
 }
Пример #15
0
 internal bool GrabPending()
 {
     KAS_Shared.DebugLog("GrabPending - Preparing To Grab part :" + this.part.partInfo.name);
     evaHolderVesselName = this.vessel.vesselName;
     evaHolderPart       = this.vessel.rootPart;
     grabbed             = grab_pending = true;
     return(true);
 }
Пример #16
0
 void OnCrewBoardVessel(GameEvents.FromToAction <Part, Part> fromToAction)
 {
     if (grabbed && fromToAction.from.vessel == evaHolderPart.vessel)
     {
         KAS_Shared.DebugLog(fromToAction.from.vessel.vesselName + " boarding " + fromToAction.to.vessel.vesselName + " with a part grabbed, dropping it to avoid destruction");
         Drop();
     }
 }
Пример #17
0
 private void OnDestroy()
 {
     KAS_Shared.DebugLog("OnDestroy(PhysicChild)");
     if (physicActive)
     {
         Stop();
     }
 }
Пример #18
0
 public void OnAttachPart(Part targetPart)
 {
     KAS_Shared.DebugLog("OnAttachPart(magnet) - Attach magnet to : " + targetPart.partInfo.title);
     if (FixedAttach.connectedPart)
     {
         MagnetActive = false;
     }
     AttachMagnet(targetPart);
 }
Пример #19
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }

            if (attachMode.Docked)
            {
                Part dockedPart = KAS_Shared.GetPartByID(this.vessel.id.ToString(), dockedPartID);
                if (dockedPart)
                {
                    KASModuleAttachCore dockedAttachModuleTmp = dockedPart.GetComponent <KASModuleAttachCore>();
                    if (dockedAttachModuleTmp)
                    {
                        KAS_Shared.DebugLog("OnLoad(Core) Re-set docking on " + dockedAttachModuleTmp.part.partInfo.title);
                        AttachDocked(dockedAttachModuleTmp);
                    }
                    else
                    {
                        KAS_Shared.DebugError("OnLoad(Core) Unable to get docked module !");
                        attachMode.Docked = false;
                    }
                }
                else
                {
                    KAS_Shared.DebugError("OnLoad(Core) Unable to get saved docked part !");
                    attachMode.Docked = false;
                }
            }

            if (attachMode.Coupled)
            {
                // Todo
            }

            if (attachMode.FixedJoint)
            {
                Part attachedPart = KAS_Shared.GetPartByID(FixedAttach.savedVesselID, FixedAttach.savedPartID);
                if (attachedPart)
                {
                    KAS_Shared.DebugLog("OnLoad(Core) Re-set fixed joint on " + attachedPart.partInfo.title);
                    AttachFixed(attachedPart, FixedAttach.savedBreakForce);
                }
                else
                {
                    KAS_Shared.DebugError("OnLoad(Core) Unable to get saved connected part of the fixed joint !");
                    attachMode.FixedJoint = false;
                }
            }
            if (attachMode.StaticJoint)
            {
                // Nothing to do (see OnVesselLoaded)
            }
            GameEvents.onVesselGoOffRails.Add(new EventData <Vessel> .OnEvent(this.OnVesselGoOffRails));
        }
Пример #20
0
        public void Detach(AttachType attachType)
        {
            KAS_Shared.DebugLog("Detach(Base) Attach type is : " + attachMode);

            // Docked
            if (attachType == AttachType.Docked)
            {
                if (dockedAttachModule.part.parent == this.part)
                {
                    KAS_Shared.DebugLog("Detach(Base) Undocking " + dockedAttachModule.part.partInfo.title + " from " + dockedAttachModule.vessel.vesselName);
                    dockedAttachModule.part.Undock(dockedAttachModule.vesselInfo);
                }
                if (this.part.parent == dockedAttachModule.part)
                {
                    KAS_Shared.DebugLog("Detach(Base) Undocking " + this.part.partInfo.title + " from " + this.vessel.vesselName);
                    this.part.Undock(this.vesselInfo);
                }
                dockedAttachModule.dockedAttachModule = null;
                this.dockedAttachModule = null;
                attachMode.Docked       = false;
            }
            // Coupled
            if (attachType == AttachType.Coupled)
            {
                // Todo
                attachMode.Coupled = false;
            }
            // FixedJoint
            if (attachType == AttachType.FixedJoint)
            {
                KAS_Shared.DebugLog("Detach(Base) Removing fixed joint on " + this.part.partInfo.title);
                if (FixedAttach.fixedJoint)
                {
                    Destroy(FixedAttach.fixedJoint);
                }
                FixedAttach.fixedJoint    = null;
                FixedAttach.connectedPart = null;
                attachMode.FixedJoint     = false;
            }
            // StaticJoint
            if (attachType == AttachType.StaticJoint)
            {
                KAS_Shared.DebugLog("Detach(Base) Removing static rigidbody and fixed joint on " + this.part.partInfo.title);
                if (StaticAttach.fixedJoint)
                {
                    Destroy(StaticAttach.fixedJoint);
                }
                if (StaticAttach.connectedGameObject)
                {
                    Destroy(StaticAttach.connectedGameObject);
                }
                StaticAttach.fixedJoint          = null;
                StaticAttach.connectedGameObject = null;
                attachMode.StaticJoint           = false;
            }
        }
Пример #21
0
        public void OnAttachPart(Part targetPart)
        {
            KAS_Shared.DebugLog("OnAttachPart(GrapplingHook)");
            if (FixedAttach.connectedPart)
            {
                DetachGrapple();
            }

            AttachPartGrapple(targetPart, partBreakForce);
        }
Пример #22
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (state == StartState.Editor || state == StartState.None)
            {
                return;
            }

            if (attachMode.Docked)
            {
                Part dockedPart = KAS_Shared.GetPartByID(this.vessel, dockedPartID);
                if (dockedPart && (dockedPart == part.parent || dockedPart.parent == part))
                {
                    KASModuleAttachCore dockedAttachModuleTmp = dockedPart.GetComponent <KASModuleAttachCore>();
                    if (dockedAttachModuleTmp == null)
                    {
                        KAS_Shared.DebugError("OnLoad(Core) Unable to get docked module !");
                        attachMode.Docked = false;
                    }
                    else if (dockedAttachModuleTmp.attachMode.Docked &&
                             dockedAttachModuleTmp.dockedPartID == part.flightID.ToString() &&
                             dockedAttachModuleTmp.vesselInfo != null)
                    {
                        KAS_Shared.DebugLog("OnLoad(Core) Part already docked to " + dockedAttachModuleTmp.part.partInfo.title);
                        this.dockedAttachModule = dockedAttachModuleTmp;
                        dockedAttachModuleTmp.dockedAttachModule = this;
                    }
                    else
                    {
                        KAS_Shared.DebugLog("OnLoad(Core) Re-set docking on " + dockedAttachModuleTmp.part.partInfo.title);
                        AttachDocked(dockedAttachModuleTmp);
                    }
                }
                else
                {
                    KAS_Shared.DebugError("OnLoad(Core) Unable to get saved docked part !");
                    attachMode.Docked = false;
                }
            }

            if (attachMode.Coupled)
            {
                // Todo
            }

            if (attachMode.FixedJoint)
            {
                StartCoroutine(WaitAndInitFixedAttach());
            }
            if (attachMode.StaticJoint)
            {
                // Nothing to do (see OnVesselLoaded)
            }
        }
Пример #23
0
        private IEnumerator WaitPhysicUpdate()
        {
            yield return(new WaitForFixedUpdate());

            KAS_Shared.SetPartLocalPosRotFrom(physicObj.transform, this.part.transform, currentLocalPos, currentLocalRot);
            if (physicObj.rigidbody.isKinematic == false)
            {
                KAS_Shared.DebugLog("WaitPhysicUpdate(PhysicChild) Set velocity to : " + this.part.rigidbody.velocity + " | angular velocity : " + this.part.rigidbody.angularVelocity);
                physicObj.rigidbody.angularVelocity = this.part.rigidbody.angularVelocity;
                physicObj.rigidbody.velocity        = this.part.rigidbody.velocity;
            }
        }
Пример #24
0
 void OnVesselGoOffRails(Vessel vess)
 {
     if (vess != this.vessel)
     {
         return;
     }
     if (attachMode.StaticJoint && !StaticAttach.fixedJoint)
     {
         KAS_Shared.DebugLog("OnVesselGoOffRails(Core) Re-attach static object");
         AttachStatic();
     }
 }
Пример #25
0
        protected override void InitFixedAttach()
        {
            base.InitFixedAttach();

            // Reset link if a fixed joint exist
            if (attachMode.FixedJoint)
            {
                KAS_Shared.DebugLog("OnStart(strut) Docked / fixed joint detected from save, relinking...");
                KASModuleStrut linkedStrutModuleSavedF = FixedAttach.connectedPart.GetComponent <KASModuleStrut>();
                LinkTo(linkedStrutModuleSavedF, false, true);
            }
        }
Пример #26
0
 /// <summary>Part's message handler.</summary>
 /// <remarks>Resumes physics handling on the object.</remarks>
 void OnPartUnpack()
 {
     if (physicObj != null && physicObjRb.isKinematic)
     {
         KAS_Shared.DebugLog("OnPartUnpack(PhysicChild)");
         physicObj.transform.parent = null;
         KAS_Shared.SetPartLocalPosRotFrom(
             physicObj.transform, part.transform, currentLocalPos, currentLocalRot);
         physicObjRb.isKinematic = false;
         StartCoroutine(WaitAndUpdateVelocities());
     }
 }
Пример #27
0
 /// <summary>Part's message handler.</summary>
 /// <remarks>Temporarily suspends physics handling on the object.</remarks>
 void OnPartPack()
 {
     if (physicObj != null)
     {
         KAS_Shared.DebugLog("OnPartPack(PhysicChild)");
         currentLocalPos            = KAS_Shared.GetLocalPosFrom(physicObj.transform, part.transform);
         currentLocalRot            = KAS_Shared.GetLocalRotFrom(physicObj.transform, part.transform);
         physicObjRb.isKinematic    = true;
         physicObj.transform.parent = part.transform;
         StartCoroutine(WaitAndUpdateVelocities());
     }
 }
Пример #28
0
 private IEnumerator WaitAndRemoveJoint()
 {
     while (!this.part.started && this.part.State != PartStates.DEAD)
     {
         KAS_Shared.DebugLog("WaitAndRemoveJoint - Waiting initialization of the part...");
         yield return(null);
     }
     if (this.part.attachJoint)
     {
         this.part.attachJoint.DestroyJoint();
     }
 }
Пример #29
0
        private void UpdateGroundContact()
        {
            if (this.part.GroundContact)
            {
                if (!groundHit)
                {
                    KAS_Shared.DebugLog(
                        "UpdateGroundContact(Anchor) - Part hit ground ! Set part friction to : "
                        + dynamicFriction);
                    orgBounciness      = this.part.collider.material.bounciness;
                    orgDynamicFriction = this.part.collider.material.dynamicFriction;
                    orgStaticFriction  = this.part.collider.material.staticFriction;
                    orgFrictionCombine = this.part.collider.material.frictionCombine;
                    this.part.collider.material.bounciness      = bounciness;
                    this.part.collider.material.dynamicFriction = dynamicFriction;
                    this.part.collider.material.staticFriction  = staticFriction;
                    this.part.collider.material.frictionCombine = PhysicMaterialCombine.Maximum;

                    KAS_Shared.DebugLog("UpdateGroundContact(Anchor) - Set part drag to : " + groundDrag);
                    orgAngularDrag         = this.part.angularDrag;
                    orgMaximum_drag        = this.part.maximum_drag;
                    orgMinimum_drag        = this.part.minimum_drag;
                    this.part.angularDrag  = groundDrag;
                    this.part.maximum_drag = groundDrag;
                    this.part.minimum_drag = groundDrag;

                    groundHit = true;
                }
            }
            else
            {
                if (groundHit)
                {
                    KAS_Shared.DebugLog(
                        "UpdateGroundContact(Anchor) - Part hit ground ! Set part material to"
                        + " (Bou,dfrict,sfrict,combine) : " + orgBounciness + " | " + orgDynamicFriction
                        + " | " + orgStaticFriction + " | " + orgFrictionCombine);
                    this.part.collider.material.bounciness      = orgBounciness;
                    this.part.collider.material.dynamicFriction = orgDynamicFriction;
                    this.part.collider.material.staticFriction  = orgStaticFriction;
                    this.part.collider.material.frictionCombine = orgFrictionCombine;

                    KAS_Shared.DebugLog("UpdateGroundContact(Anchor) - Set part drag to (Ang,max,min) : "
                                        + orgAngularDrag + " | " + orgMaximum_drag + " | " + orgMinimum_drag);
                    this.part.angularDrag  = orgAngularDrag;
                    this.part.maximum_drag = orgMaximum_drag;
                    this.part.minimum_drag = orgMinimum_drag;

                    groundHit = false;
                }
            }
        }
Пример #30
0
 public void OnPartPack()
 {
     if (physicActive)
     {
         KAS_Shared.DebugLog("OnPartPack(PhysicChild)");
         currentLocalPos = KAS_Shared.GetLocalPosFrom(physicObj.transform, this.part.transform);
         currentLocalRot = KAS_Shared.GetLocalRotFrom(physicObj.transform, this.part.transform);
         FlightGlobals.removePhysicalObject(physicObj);
         physicObj.rigidbody.isKinematic = true;
         physicObj.transform.parent      = this.part.transform;
         StartCoroutine(WaitPhysicUpdate());
     }
 }