예제 #1
0
        void Start()
        {
            //            fun.setTimeScale(0.2);

//            Application.targetFrameRate = 90;
//            QualitySettings.vSyncCount = 0;


            var cone = fun.meshes.CreatePointyCone(
                new DtCone
            {
                height       = 0.5,
                topRadius    = 0.001,
                bottomRadius = 0.5,
                relNoseLen   = 5
            }).transform
                       .SetColor(0xFF0000FF)
//                .SetHideFlags(HideFlags.HideInHierarchy)
            ;

            _bone = new GameObject("Soft").transform.SetPosition(-3, 0, 0);
            cone.SetParent(_bone);
            cone.localRotation = Quaternion.LookRotation(v3.bk, v3.up);
            cone.localPosition = V3(0, 0, 3);
            _bone.rotation     = Quaternion.LookRotation(v3.rt, v3.up);

            _rigid = GameObject.CreatePrimitive(PrimitiveType.Cube).transform
                     .SetColor(0x0000FFFF).SetPosition(-4, 0, 0);

            _bone.SetParent(_rigid);

            _sja = new SoftBodyJiggleAgent(new SoftBodyConfig
            {
                Bone        = _bone,
                RelTargetAt = 3,
                MaxDegrees  = 50
            });

            _log = GameObject.Find("LogText").GetComponent <Text>();
        }
예제 #2
0
        public HumBreastGroup(
            string persona,
            BodySide side,
            IComplexHuman human,
            Transform pectoral,
            HumBoneHandler nipple,
            BreastConfigSource configSource)
        {
            _persona           = persona;
            _side              = side;
            _human             = human;
            _pectoral          = pectoral;
            _nipple            = nipple;
            Part               = side == BodySide.LT ? BodyPart.BreastL : BodyPart.BreastR;
            _iniBreastLocFw    = _pectoral.forward.AsLocalDir(_pectoral.parent);
            _iniBreastLocUp    = _pectoral.up.AsLocalDir(_pectoral.parent);
            _iniWorldUpAsLocal = v3.up.AsLocalDir(_pectoral.parent);
            if (_nipple != null)
            {
                _iniNippleLocPos = _nipple.position.AsLocalPoint(_pectoral.parent);
            }
            _iniBreastLocPos = _pectoral.localPosition;

            var softBodyConfig = configSource?.GetConfig() ??
                                 new SoftBodyConfig
            {
                MaxStretch        = 0.10,
                MaxSqueeze        = 0.05,
                MaxDegrees        = 30,
                RelTargetAt       = 0.26,
                Stiffness         = 0.01,
                Mass              = 0.20,
                Damping           = 0.10,
                Gravity           = 0.05,
                RelDownResistance = 0.70
            };

            softBodyConfig.Bone = _pectoral;

//            var softBodyConfig = new SoftBodyConfig
//            {
//                Bone = _pectoral,
//                MaxStretch = 0.10,
//                MaxSqueeze = 0.05,
//                MaxDegrees = 25,
//                RelTargetAt = 0.26,
//                Stiffness = 0.05,
//                Mass = 0.50,
//                Damping = 0.50,
//                Gravity = 0.05,
//                RelDownResistance = 0.80
//            };

            fire(new RegisterSoftBodyConfig(human, side, Part, softBodyConfig));

            _jiggle = new SoftBodyJiggleAgent(softBodyConfig);

            subscribe <CancelInertia>(human, e =>
            {
                _jiggle.Pendulum.CancelInertia();
            }, this);
        }