Beispiel #1
0
 //Update all cloth components
 public void UpdateClothColliders()
 {
     if (_umaData)
     {
         foreach (Renderer renderer in _umaData.GetRenderers())
         {
             Cloth cloth = renderer.GetComponent <Cloth> ();
             if (cloth)
             {
                 cloth.sphereColliders  = SphereColliders.ToArray();
                 cloth.capsuleColliders = CapsuleColliders.ToArray();
                 if ((cloth.capsuleColliders.Length + cloth.sphereColliders.Length) > 10)
                 {
                     Debug.LogWarning("Cloth Collider count is high. You might experience strange behavior with the cloth simulation.");
                 }
             }
         }
     }
 }
Beispiel #2
0
        protected override void Init(MyObjectBuilder_DefinitionBase def)
        {
            base.Init(def);
            var ob = (MyObjectBuilder_ClothColliderComponentDefinition)def;

            CapsuleColliders = ob.CapsuleColliders ?? new MyObjectBuilder_ClothColliderComponentDefinition.Capsule[0];
            SphereColliders  = ob.SphereColliders ?? new MyObjectBuilder_ClothColliderComponentDefinition.Sphere[0];
            IsSkinned        = CapsuleColliders.Any(x => !string.IsNullOrEmpty(x.Bone)) || SphereColliders.Any(x => !string.IsNullOrEmpty(x.Bone));
        }