public override void InitReferences()
    {
        base.InitReferences();

        _eyeBehavior = (EyesControl)containingAtom.GetStorableByID("Eyes");
        _head        = context.bones.First(eye => eye.name == "head").transform;
        _lEye        = context.bones.First(eye => eye.name == "lEye").transform;
        _rEye        = context.bones.First(eye => eye.name == "rEye").transform;
        _eyeTarget   = containingAtom.freeControllers.First(fc => fc.name == "eyeTargetControl");
    }
Exemple #2
0
    public override void Awake()
    {
        base.Awake();

        _eyeBehavior = (EyesControl)containingAtom.GetStorableByID("Eyes");
        _head        = containingAtom.rigidbodies.First(fc => fc.name == "head").transform;
        var eyes = containingAtom.GetComponentsInChildren <LookAtWithLimits>();

        _lEye      = eyes.First(eye => eye.name == "lEye").transform;
        _rEye      = eyes.First(eye => eye.name == "rEye").transform;
        _eyeTarget = containingAtom.freeControllers.First(fc => fc.name == "eyeTargetControl");
    }
        public HeadController(DollmasterPlugin dm) : base(dm)
        {
            headControlEnabled = new JSONStorableBool("headControlEnabled", true);
            dm.RegisterBool(headControlEnabled);
            UIDynamicToggle moduleEnableToggle = dm.CreateToggle(headControlEnabled);

            moduleEnableToggle.label           = "Enable Head Gaze";
            moduleEnableToggle.backgroundColor = Color.green;

            durationBetweenLookChange = new JSONStorableFloat("duration between look at toggle", 8, 1, 30, false);
            dm.RegisterFloat(durationBetweenLookChange);
            dm.CreateSlider(durationBetweenLookChange);

            headTurnSpeed = new JSONStorableFloat("headTurnSpeed", 2.5f, 0.01f, 20.0f);
            dm.RegisterFloat(headTurnSpeed);
            dm.CreateSlider(headTurnSpeed);

            headControl  = atom.GetStorableByID("headControl") as FreeControllerV3;
            chestControl = atom.GetStorableByID("chestControl") as FreeControllerV3;
            chestBone    = atom.GetStorableByID("chest") as DAZBone;
            neckBone     = atom.GetStorableByID("neck") as DAZBone;
            hipBone      = atom.GetStorableByID("hip") as DAZBone;

            alwaysLookAtMe = new JSONStorableBool("alwaysLookAtMe", false);
            dm.RegisterBool(alwaysLookAtMe);
            UIDynamicToggle forceLookToggle = ui.CreateToggle("Hold Gaze", 180, 40);

            alwaysLookAtMe.toggle = forceLookToggle.toggle;

            forceLookToggle.transform.Translate(0.415f, 0.01f, 0, Space.Self);
            forceLookToggle.backgroundColor = new Color(0.2f, 0.2f, 0.2f);
            forceLookToggle.labelText.color = new Color(1, 1, 1);

            eyesControl = atom.GetStorableByID("Eyes") as EyesControl;

            dm.CreateSpacer(true);

            saccadeEnabled = new JSONStorableBool("saccadeEnabled", true);
            dm.RegisterBool(saccadeEnabled);
            dm.CreateToggle(saccadeEnabled);

            dummy = new GameObject();
        }
        public override void Init()
        {
            eyesControl = containingAtom.GetStorableByID("Eyes") as EyesControl;

            faceCollider = containingAtom.GetComponentsInChildren <CapsuleCollider>().ToList().Find(collider => collider.name == "AutoColliderAutoCollidersFaceCentral1Hard");

            headBone = containingAtom.GetStorableByID("head") as DAZBone;

            leftEyeReference = new GameObject().transform;
            leftEyeReference.SetParent(headBone.transform, false);
            leftEyeReference.localPosition = new Vector3(-0.05f, 0.05f, 0.05f);

            rightEyeReference = new GameObject().transform;
            rightEyeReference.SetParent(headBone.transform, false);
            rightEyeReference.localPosition = new Vector3(0.05f, 0.05f, 0.05f);

            #region Debug
            //debugObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            //GameObject.Destroy(debugObject.GetComponent<Collider>());
            //debugObject.transform.SetParent(headBone.transform, false);
            //debugObject.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
            //debugObject.transform.localPosition = new Vector3(-0.05f, 0.05f, 0.05f);

            //float radius = faceCentralCollider.radius;
            //float height = faceCentralCollider.height;
            //debugObject = GameObject.CreatePrimitive(PrimitiveType.Capsule);
            //debugObject.transform.SetParent(faceCentralCollider.transform, false);
            //debugObject.transform.parent = faceCentralCollider.gameObject.transform;
            //debugObject.transform.localScale = new Vector3(radius, height * 0.5f, radius);
            //GameObject.Destroy(debugObject.GetComponent<Collider>());
            #endregion

            JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
            DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;
            leftSquintMorph    = morphControl.GetMorphByDisplayName("Eyes Squint Left");
            rightSquintMorph   = morphControl.GetMorphByDisplayName("Eyes Squint Right");
            pupilDilationMorph = morphControl.GetMorphByDisplayName("PupilDilation");

            RegisterFloat(squintSpeed);
            CreateSlider(squintSpeed);
        }
Exemple #5
0
    public override void Awake()
    {
        base.Awake();

        _eyeBehavior = (EyesControl)containingAtom.GetStorableByID("Eyes");
        _head        = context.bones.First(eye => eye.name == "head").transform;
        _lEye        = context.bones.First(eye => eye.name == "lEye").transform;
        _rEye        = context.bones.First(eye => eye.name == "rEye").transform;
        _eyeTarget   = containingAtom.freeControllers.First(fc => fc.name == "eyeTargetControl");
        trackMirrorsJSON.setCallbackFunction = _ => { if (enabled)
                                                      {
                                                          Rescan();
                                                      }
        };
        trackWindowCameraJSON.setCallbackFunction = _ => { if (enabled)
                                                           {
                                                               Rescan();
                                                           }
        };
        saccadeMinDurationJSON.setCallbackFunction = val => saccadeMaxDurationJSON.valNoCallback = Mathf.Max(val, saccadeMaxDurationJSON.val);
        saccadeMaxDurationJSON.setCallbackFunction = val => saccadeMinDurationJSON.valNoCallback = Mathf.Min(val, saccadeMinDurationJSON.val);
    }