Beispiel #1
0
 /// <summary>Disables/enables all the colliders between the parts.</summary>
 /// <remarks>The ignore state is reset to <c>false</c> on every scene load.</remarks>
 /// <param name="part1">Source part.</param>
 /// <param name="part2">Target part.</param>
 /// <param name="ignore">
 /// If <c>true</c> then the collisions between the parts will be ignored. Otherwise, the
 /// collisions will be handled.
 /// </param>
 /// <seealso href="https://docs.unity3d.com/ScriptReference/Collider.html">
 /// Unity3D: Collider</seealso>
 /// <seealso href="https://docs.unity3d.com/ScriptReference/Physics.IgnoreCollision.html">
 /// Unity3D: Physics.IgnoreCollision</seealso>
 public static void SetCollisionIgnores(Part part1, Part part2, bool ignore)
 {
     Debug.LogFormat("Set collision ignores between {0} and {1} to {2}",
                     DbgFormatter.PartId(part1), DbgFormatter.PartId(part2), ignore);
     SetCollisionIgnores(
         Hierarchy.GetPartModelTransform(part1), Hierarchy.GetPartModelTransform(part2), ignore);
 }
Beispiel #2
0
        /// <summary>Disables/enables all the collidres between the part and a vessel.</summary>
        /// <param name="part">The part to adjust colliders for.</param>
        /// <param name="vessel">The vessel to start/stop colliding with.</param>
        /// <param name="ignore">The desired state of the collision check.</param>
        public static void SetCollisionIgnores(Part part, Vessel vessel, bool ignore)
        {
            DebugEx.Fine("Set collision ignores between {0} and {1} to {2}", part, vessel, ignore);
            var modelRoot = Hierarchy.GetPartModelTransform(part);

            vessel.parts.ForEach(
                p => SetCollisionIgnores(modelRoot, Hierarchy.GetPartModelTransform(p), ignore));
        }
Beispiel #3
0
 /// <summary>Disables/enables all the colliders between the parts.</summary>
 /// <remarks>The ignore state is reset to <c>false</c> on every scene load.</remarks>
 /// <param name="part1">Source part.</param>
 /// <param name="part2">Target part.</param>
 /// <param name="ignore">
 /// If <c>true</c> then the collisions between the parts will be ignored. Otherwise, the
 /// collisions will be handled.
 /// </param>
 /// <seealso href="https://docs.unity3d.com/ScriptReference/Collider.html">
 /// Unity3D: Collider</seealso>
 /// <seealso href="https://docs.unity3d.com/ScriptReference/Physics.IgnoreCollision.html">
 /// Unity3D: Physics.IgnoreCollision</seealso>
 public static void SetCollisionIgnores(Part part1, Part part2, bool ignore)
 {
     DebugEx.Fine("Set collision ignores between {0} and {1} to {2}", part1, part2, ignore);
     SetCollisionIgnores(
         Hierarchy.GetPartModelTransform(part1), Hierarchy.GetPartModelTransform(part2), ignore);
 }
Beispiel #4
0
 /// <inheritdoc cref="FindTransformByPath(Transform,string,Transform)"/>
 public static Transform FindPartModelByPath(Part parent, string[] path,
                                             Transform defValue = null)
 {
     return(FindTransformByPath(Hierarchy.GetPartModelTransform(parent), path, defValue: defValue));
 }