Exemple #1
0
            private void TweakBody()
            {
                if (!BreastColliders.Value)
                {
                    return;
                }

                var bc = new List <DynamicBoneCollider>();

                float titsize   = ChaControl.chaFile.custom.body.shapeValueBody[(int)BodyShapeIdx.BustSize];
                float cowfactor = titsize * 1.2f;

                // bind colliders to hands
                foreach (var collider in ColliderList)
                {
                    bc.Add(AddCollider(collider.BoneName, collider.ColliderRadius, collider.CollierHeight, collider.ColliderCenter));
                }

                // tell the t**s that hands collide it
                foreach (var tit in ChaControl.objAnim.GetComponentsInChildren <DynamicBone_Ver02>(true))
                {
                    if (!TitComments.Contains(tit.Comment))
                    {
                        continue;
                    }

                    // register the colliders if not already there
                    foreach (var c in bc)
                    {
                        if (c != null && !tit.Colliders.Contains(c))
                        {
                            tit.Colliders.Add(c);
                        }
                    }

                    // expand the collision radius for the first two dynbones
                    foreach (var pat in tit.Patterns)
                    {
#if KK
                        pat.Params[0].CollisionRadius = 0.08f * cowfactor;
                        pat.Params[1].CollisionRadius = 0.06f * cowfactor;
#elif AI
                        pat.Params[2].CollisionRadius = 0.8f * cowfactor;
                        pat.Params[3].CollisionRadius = 0.6f * cowfactor;
#endif
                    }

                    tit.GetType().GetMethod("InitNodeParticle", AccessTools.all).Invoke(tit, null);
                    tit.GetType().GetMethod("SetupParticles", AccessTools.all).Invoke(tit, null);
                    tit.InitLocalPosition();
                    if ((bool)tit.GetType().GetMethod("IsRefTransform", AccessTools.all).Invoke(tit, null))
                    {
                        tit.setPtn(0, true);
                    }
                    tit.GetType().GetMethod("InitTransforms", AccessTools.all).Invoke(tit, null);
                }
            }
            private void TweakBody()
            {
                if (!BreastColliders.Value)
                {
                    return;
                }

                var bc = new List <DynamicBoneCollider>();

                // floor pseudo-collider
                bc.Add(AddCollider(RootBoneName, sz: 100, t: new Vector3(0, -10.01f, -0.01f)));

                float titsize = ChaControl.chaFile.custom.body.shapeValueBody[(int)BodyShapeIdx.BustSize];

                //XXX: maybe skip for small t**s in general?
                //if (ctrl.sex == 0) return;
                //if (titsize < 0.2f) return;

                // bind colliders to hands
                foreach (var armBone in ArmBoneNames)
                {
                    bc.Add(AddCollider(armBone, sx: 0.35f, sy: 0.35f, sz: 0.3f));
                }

                // large t**s need special case as the standard hitbox morph doesn't like shape values above 1
                var cowfactor = System.Math.Max(1f, titsize);

                // tell the t**s that hands collide it
                foreach (var tit in ChaControl.objAnim.GetComponentsInChildren <DynamicBone_Ver02>(true))
                {
                    if (!TitComments.Contains(tit.Comment))
                    {
                        continue;
                    }

                    // register the colliders if not already there
                    foreach (var c in bc)
                    {
                        if (c != null && !tit.Colliders.Contains(c))
                        {
                            tit.Colliders.Add(c);
                        }
                    }

                    // expand the collision radius for the first two dynbones
                    foreach (var pat in tit.Patterns)
                    {
                        pat.Params[0].CollisionRadius = 0.08f * cowfactor;
                        pat.Params[1].CollisionRadius = 0.06f * cowfactor;
                    }

                    tit.GetType().GetMethod("InitNodeParticle", AccessTools.all).Invoke(tit, null);
                    tit.GetType().GetMethod("SetupParticles", AccessTools.all).Invoke(tit, null);
                    tit.InitLocalPosition();
                    if ((bool)tit.GetType().GetMethod("IsRefTransform", AccessTools.all).Invoke(tit, null))
                    {
                        tit.setPtn(0, true);
                    }
                    tit.GetType().GetMethod("InitTransforms", AccessTools.all).Invoke(tit, null);
                }
            }