public void Initialize( IVRMLoadable vrmLoadable, Camera mainCam, IKTargetTransforms ikTargets, FaceControlConfiguration faceControlConfig) { _camera = mainCam.transform; _lookAtTarget = ikTargets.LookAt; _faceControlConfig = faceControlConfig; vrmLoadable.VrmLoaded += info => { _head = info.animator.GetBoneTransform(HumanBodyBones.Head); _lookAtIk = info.vrmRoot.GetComponent <LookAtIK>(); _vrmLookAtHead = info.vrmRoot.GetComponent <VRMLookAtHead>(); _hasModel = true; }; vrmLoadable.VrmDisposing += () => { _hasModel = false; _lookAtIk = null; _vrmLookAtHead = null; _head = null; }; }
void Start() { animator = transform.GetComponent <Animator>(); sas = transform.GetComponent <SimpleAimingSystem>(); aik = transform.GetComponent <AimIK>(); laik = transform.GetComponent <LookAtIK>(); }
public float moveDirectionDeviation = 5F; //Move direction acceptable deviation // Use this for initialization void Start() { //Cache Components and Objects anim = GetComponent <Animator>(); world = GameObject.FindGameObjectWithTag("World").GetComponent <SoccerWorld>(); //Cache Animator Parameters moveSpeedHash = Animator.StringToHash("Speed"); moveDirectionHash = Animator.StringToHash("MoveDirection"); targetDistanceHash = Animator.StringToHash("TargetDistance"); abruptStopHash = Animator.StringToHash("AbruptStop"); turnLeftInPlaceHash = Animator.StringToHash("TurnLeftInPlace"); turnRightInPlaceHash = Animator.StringToHash("TurnRightInPlace"); followTargetHash = Animator.StringToHash("FollowTarget"); //Setup Listeners MessageDispatcher.AddListener("ball_controlled_by", this.gameObject.name, takeBallControl, true); //Initial setup player target myTarget = GameObject.FindGameObjectWithTag("Ball"); if (myTarget) { LookAtIK myLookTarget = GetComponent <LookAtIK>(); myLookTarget.solver.target = myTarget.transform; } }
public override void Init(Role role) { base.Init(role); m_LookAtIK = role.monoReference.lookAtIK; m_LookAtIK.solver.target = null; m_LookAtIK.solver.IKPositionWeight = 0; lastPosition = m_LookAtIK.solver.IKPosition; }
public override void Awake() { base.Awake(); _animator = GetComponent <Animator>(); _lookIk = GetComponent <LookAtIK>(); _lookTransform = transform.Find("LookPosition"); _characterController = GetComponent <CharacterController>(); }
public void SetVideoChatMode(VRMLookAtHead lookAtHead, LookAtIK lookAtIk, VRMFirstPerson firstPerson) { lookAtHead.Target = Camera.main.transform; lookAtIk.solver.target = lookAtHead.Target; var headCenter = firstPerson.FirstPersonBone.localToWorldMatrix.MultiplyPoint(firstPerson.FirstPersonOffset); headCenter.z = .9f; Camera.main.transform.position = headCenter; _receivedMessageHandler.ReceiveCommand(new ReceivedCommand(MessageCommandNames.EnableDesktopShareMode, false.ToString())); }
public static void SetHeadTarget(GameObject agent, Transform target) { LookAtIK ik = agent.GetComponent <LookAtIK>(); if (target != null) { ik.solver.target.position = target.position; ik.solver.IKPositionWeight = 1.0f; } else { ik.solver.IKPositionWeight = 0.0f; } }
void Start() { //head = GameObject.Find("Head").transform; surface = GameObject.Find("Surface"); //help = GameObject.Find("HelpPanel"); assistant = GameObject.Find("Assistant"); //setup lookat bones lookAt = assistant.GetComponent <LookAtIK>(); centerEye = GameObject.Find("CenterEyeAnchor").transform; agent_rightHand = GameObject.Find("RightHand").transform; user_rightHand = GameObject.Find("RightHandAnchor").transform; //initialize the task task = surface.AddComponent <Task4Rules>(); task.Initialize(); action = surface.AddComponent <Actions>(); action.Initialize(task); dict = task.dict; // InitOVRHand(); //test correctAction //task.CreateNewTask(3); ////task.ShowDemos(); //action.ActionTaken(3); ////load audio source LoadAudios(); audioSource = assistant.GetComponent <AudioSource>(); PlayAudio(clips[0]); //start to music and say the introduction of the system ////start the level loop keywords.Add("start", () => { StartCalled(); }); keywords.Add("repeat", () => { StartCalled(); }); keywords.Add("demostration", () => { DemoCalled(); }); keywords.Add("continue", () => { ContinueCalled(); }); keywords.Add("done", () => { DoneCalled(); }); keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray()); keywordRecognizer.OnPhraseRecognized += KWRegOnPhraseRecognized; keywordRecognizer.Start(); }
void Start() { fDist = DIST; zoomOutDist = DIST; fRight = RIGHT; fDampTrace = DAMP_TRACE; trTarget = GameObject.FindGameObjectWithTag(Tags.CameraTarget).GetComponent <Transform>(); trPlayerModel = GameObject.FindGameObjectWithTag(Tags.PlayerModel).transform; lookAt = GameObject.FindGameObjectWithTag(Tags.PlayerModel).GetComponent <LookAtIK>(); lookAt.enabled = false; moveCtrl = GameObject.FindGameObjectWithTag(Tags.Player).GetComponent <T2.MoveCtrl>(); vTarget = trTarget.position + (trTarget.forward * 30.0f); fCamDist = 0.1f; }
//------------------------------------------------------------------------------------------------------------------------- private void Start() { if (aimIK = GetComponent <AimIK>()) { aimTarget = new GameObject("[" + this.name + "] Aim Target").transform; aimTarget.position = aimPoint = transform.forward * parameters.targetingRange; aimIK.solver.target = aimTarget; aimIK.solver.IKPositionWeight = aimWeight = 0; } if (lookIK = GetComponent <LookAtIK>()) { lookTarget = new GameObject("[" + this.name + "] Look Target").transform; lookTarget.position = lookPoint = transform.forward * parameters.targetingRange; lookIK.solver.target = lookTarget; lookIK.solver.IKPositionWeight = 1; } }
void Start() { deadrobots = true; box = GetComponentInChildren <BoxCollider>(); damageT = new WaitForSeconds(damageTimer); anim = GetComponent <Animator>(); rot = GetComponentInChildren <Rotate>(); rot2 = GetComponentInChildren <Rotate2>(); Look = GetComponent <LookAtIK>(); GameObject slidH = Instantiate(sliderPrefabH, transform.position, Quaternion.identity) as GameObject; slidH.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform); healthSlider = slidH.GetComponentInChildren <Slider>(); healthTrans = slidH.GetComponent <RectTransform>(); ragdollUtility = GetComponentInChildren <RagdollUtility>(); fbbik = GetComponent <FullBodyBipedIK>(); capsul = GetComponent <CapsuleCollider>(); agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); //substractOnce = false; dark = GameObject.FindGameObjectWithTag("Dark").GetComponent <DarkCity>(); }
private void OnEnable() { if (characterAnimator == null) { characterAnimator = GetComponent <Animator>(); } if (rb == null) { rb = GetComponent <Rigidbody>(); } //if (rightHandIKAnimator == null) rightHandIKAnimator = rightHandIK.GetComponent<Animator>(); cameraRig.gameObject.SetActive(true); characterAnimator.SetBool("Aiming", true); //characterAnimator.SetLayerWeight(characterAnimator.GetLayerIndex("Right Hand IK"), 1f); //characterAnimator.SetLayerWeight(characterAnimator.GetLayerIndex("Left Hand IK"), 1f); characterAnimator.SetLayerWeight(characterAnimator.GetLayerIndex("Legs"), 1f); aimingRigAnimator.Play("Vertical Aiming", 0, verticalAngle); aimingRigAnimator.Update(1f); if (aimIK == null) { aimIK = GetComponent <AimIK>(); } if (fbbIK == null) { fbbIK = GetComponent <FullBodyBipedIK>(); } if (lookAtIK == null) { lookAtIK = GetComponent <LookAtIK>(); } aimIK.enabled = false; fbbIK.enabled = false; lookAtIK.enabled = false; fbbIK.solver.leftArmChain.bendConstraint.weight = 1f; }
private void Awake() { #if DEBUGMODE _targetRPrev = new List<Vector3>(); _targetLPrev = new List<Vector3>(); //_handRPrev = new List<Vector3>(); //_handRTime = new List<float>(); // _handCurve = GameObject.Find("HandCurve"); #endif _animInfo = GetComponent<AnimationInfo>(); _fbIk = GetComponent<FullBodyBipedIK>(); _laIk = GetComponentInChildren<LookAtIK>(); EncSpr = new float[3]; SinRis = new float[3]; RetAdv = new float[3]; ShapeTi = 0f; _torso = GetComponent<TorsoController>(); Reset(); }
//Material red, m1; void Start() { surface = GameObject.Find("Surface"); //help = GameObject.Find("HelpPanel"); assistant = GameObject.Find("Assistant"); //ik = assistant.GetComponent<FullBodyBipedIK>(); //setup lookat bones lookAt = assistant.GetComponent <LookAtIK>(); centerEye = GameObject.Find("CenterEyeAnchor").transform; agent_rightHand = GameObject.Find("RightHand").transform; user_rightHand = GameObject.Find("RightHandAnchor").transform; //initialize the task task = surface.AddComponent <Task4Rules>(); task.Initialize(); action = surface.AddComponent <Actions>(); action.Initialize(task); dict = task.dict; //s_action = gameObject.GetComponent<SuggestAction>(); // InitOVRHand(); //test correctAction //task.CreateNewTask(3); ////task.ShowDemos(); //action.ActionTaken(3); ////load audio source LoadAudios(); audioSource = assistant.GetComponent <AudioSource>(); PlayAudio(clips[0]); //start to music and say the introduction of the system //MoveTargHolder(); ////start the level loop keywords.Add("start", () => { StartCalled(); }); //keywords.Add("repeat", () => { StartCalled(); }); keywords.Add("demostration", () => { DemoCalled(); }); keywords.Add("continue", () => { ContinueCalled(); }); keywords.Add("done", () => { DoneCalled(); }); keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray()); keywordRecognizer.OnPhraseRecognized += KWRegOnPhraseRecognized; keywordRecognizer.Start(); Debug.Log("play audio 3"); if (File.Exists(dataPath) == false) { var outfile = new StreamWriter(dataPath, true); outfile.WriteLine("Create File " + System.DateTime.Now.ToString()); outfile.WriteLine("------ " + System.DateTime.UtcNow.ToString()); outfile.Close(); } else { var outfile = new StreamWriter(dataPath, true); outfile.WriteLine("*****************************PARTICIPANT***CORRECTIVE FEEDBACK*****************************" + System.DateTime.UtcNow.ToString()); outfile.WriteLine("****************************** system 1 with picture set 1 ************************"); //outfile.WriteLine("------ " + sce_name.name + " ------ " + System.DateTime.UtcNow.ToString()); outfile.Close(); } }
protected override void Initialize() { if (fullbodyIK == null) { fullbodyIK = GetComponent <FullBodyBipedIK>(); } if (fullbodyIK != null) { if (rightHandTarget == null) { rightHandTarget = CreateIKEffectors("RightHand Effector Target", m_animator.GetBoneTransform(HumanBodyBones.RightHand).position, m_animator.GetBoneTransform(HumanBodyBones.RightHand).rotation); fullbodyIK.solver.rightHandEffector.target = rightHandTarget; } if (leftHandTarget == null) { leftHandTarget = CreateIKEffectors("LeftHand Effector Target", m_animator.GetBoneTransform(HumanBodyBones.LeftHand).position, m_animator.GetBoneTransform(HumanBodyBones.LeftHand).rotation); fullbodyIK.solver.leftHandEffector.target = leftHandTarget; } if (bodyEffectorTarget == null) { bodyEffectorTarget = CreateIKEffectors("Body Effector Target", m_animator.GetBoneTransform(HumanBodyBones.Hips).position, m_animator.GetBoneTransform(HumanBodyBones.Hips).rotation); fullbodyIK.solver.bodyEffector.target = bodyEffectorTarget; } } if (lookatIK == null) { lookatIK = GetComponent <LookAtIK>(); } if (lookatIK != null) { if (lookTarget == null) { lookTarget = CreateIKEffectors("LookAt Target", m_animator.GetBoneTransform(HumanBodyBones.Head).position + transform.forward, Quaternion.identity); lookTarget.position = m_animator.GetBoneTransform(HumanBodyBones.Neck).position + transform.forward * 10; lookatIK.solver.target = lookTarget; } lookatIK.solver.head = new IKSolverLookAt.LookAtBone(m_animator.GetBoneTransform(HumanBodyBones.Head)); IKSolverLookAt.LookAtBone[] spineBones = { new IKSolverLookAt.LookAtBone(m_animator.GetBoneTransform(HumanBodyBones.Spine)), new IKSolverLookAt.LookAtBone(m_animator.GetBoneTransform(HumanBodyBones.Chest)), new IKSolverLookAt.LookAtBone(m_animator.GetBoneTransform(HumanBodyBones.UpperChest)), new IKSolverLookAt.LookAtBone(m_animator.GetBoneTransform(HumanBodyBones.Neck)) }; lookatIK.solver.spine = spineBones; } // --------------- // GrounderIK // --------------- //GrounderFBBIK.SpineEffector[] spineEffectors = { // new GrounderFBBIK.SpineEffector(FullBodyBipedEffector.LeftShoulder, 1, 0.3f) //}; //grounderIK.spine = spineEffectors; grounderIK.solver.maxStep = m_controller.characterCollider.radius; grounderIK.solver.quality = Grounding.Quality.Simple; }
// Start is called before the first frame update private void Start() { _fik = GetComponent <FullBodyBipedIK>(); _headIk = GetComponent <LookAtIK>(); _lookAt = GetComponent <LookAtController>(); }