/// <summary> /// Check for new movement and Update the animation using Animator triggers. /// Update is called once per frame /// </summary> void Update() { TimeCount(); if (MoveTACLimbManually == true) { ManualControl(false); } else { ManualControl(true); } if (!MuscularActivityMap && Mam != null && Mam.isVisible) { Mam.Deactivate(); } //update heatmap only if heat is true to prevent errors if (UpdateMuscularActivityMap && CurrentMuscularActivityMap != null) { if (Mam == null) { Mam = new Heatmap(colormap, alpha, cubeheight, map3D, MainArm); } Mam.UpdateHeatMap(CurrentMuscularActivityMap, cubeheight, map3D, MuscularActivityMap, innerGrowing); UpdateMuscularActivityMap = false; } // use left or right arm if (RotateArm) { GameObject.Find("lower_arm").transform.localScale = new Vector3(-GameObject.Find("lower_arm").transform.localScale.x, GameObject.Find("lower_arm").transform.localScale.y, GameObject.Find("lower_arm").transform.localScale.z); GameObject.Find("lower_arm").transform.Rotate(GameObject.Find("lower_arm").transform.up, 180, Space.World); RotateArm = false; } //position thumb for palmar or lateral if (usePalmarGrasp) { animArm.SetFloat("f_GraspClose", 1f); } else { animArm.SetFloat("f_GraspClose", 0f); } //play the animations foreach (DOF x in DOF_ArmList) { //Der Übergang von >0 zu <0 und umgekehrt wird wahrscheinlich Probleme bereiten, weil der Parameter der Gegenbewegung nicht automatisch 0 ist. if (x.CurrentValue > 0) { animArm.SetFloat(x.NamePos, x.GetPostiveLimit(), deltaBetweenMovements, Time.deltaTime * deltaTimeFactor); animArm.SetFloat(x.NameNeg, 0, deltaBetweenMovements, Time.deltaTime * deltaTimeFactor); } else { animArm.SetFloat(x.NameNeg, x.GetNegativeLimit(), deltaBetweenMovements, Time.deltaTime * deltaTimeFactor); animArm.SetFloat(x.NamePos, 0, deltaBetweenMovements, Time.deltaTime * deltaTimeFactor); } } }
/// <summary> /// Check for new movement and Update the animation using Animator triggers. /// Update is called once per frame /// </summary> void Update() { TimeCount(); TACArm.GetComponentInChildren <SkinnedMeshRenderer>().enabled = TACArmSkinR; if (Input.GetKeyDown(KeyCode.J)) { MainArmLayer = "Outline"; } if (Input.GetKeyDown(KeyCode.K)) { MainArmLayer = "Default"; } SetLayer(MainArm.transform, LayerMask.NameToLayer(MainArmLayer)); if (MoveTACLimbManually == true) { ManualControl(false); } else { ManualControl(true); } if (RotateArm) { GameObject.Find("lower_arm").transform.localScale = new Vector3(-GameObject.Find("lower_arm").transform.localScale.x, GameObject.Find("lower_arm").transform.localScale.y, GameObject.Find("lower_arm").transform.localScale.z); GameObject.Find("lower_arm").transform.Rotate(GameObject.Find("lower_arm").transform.up, 180, Space.World); RotateArm = false; } //update heatmap only if heat is true to prevent errors if (UpdateMuscularActivityMap && CurrentMuscularActivityMap != null) { if (Mam == null) { Mam = new Heatmap(colormap, alpha, cubeheight, map3D, MainArm); } Mam.UpdateHeatMap(CurrentMuscularActivityMap, cubeheight, map3D, MuscularActivityMap, innerGrowing); } if (!MuscularActivityMap && Mam != null && Mam.isVisible) { Mam.Deactivate(); } //position thumb for palmar or lateral if (usePalmarGrasp) { animArm.SetFloat("f_GraspClose", 1f); } else { animArm.SetFloat("f_GraspClose", 0f); } if (Input.GetKeyDown(KeyCode.H)) { blockAnimation = !blockAnimation; } //animation should be block if object is grasped if (!blockAnimation) { //play the animations foreach (DOF x in DOF_ArmList) { //Der Übergang von >0 zu <0 und umgekehrt wird wahrscheinlich Probleme bereiten, weil der Parameter der Gegenbewegung nicht automatisch 0 ist. if (x.CurrentValue > 0) { animArm.SetFloat(x.NamePos, x.GetPostiveLimit(), deltaBetweenMovements, Time.deltaTime * deltaTimeFactor); animArm.SetFloat(x.NameNeg, 0, deltaBetweenMovements, Time.deltaTime * deltaTimeFactor); } else { animArm.SetFloat(x.NameNeg, x.GetNegativeLimit(), deltaBetweenMovements, Time.deltaTime * deltaTimeFactor); animArm.SetFloat(x.NamePos, 0, deltaBetweenMovements, Time.deltaTime * deltaTimeFactor); } } } //play the animations foreach (DOF x in DOF_TAC_ArmList) { //Der Übergang von >0 zu <0 und umgekehrt wird wahrscheinlich Probleme bereiten, weil der Parameter der Gegenbewegung nicht automatisch 0 ist. if (x.CurrentValue > 0) { animTACArm.SetFloat(x.NamePos, x.GetPostiveLimit(), 0f, 0f); animTACArm.SetFloat(x.NameNeg, 0, 0f, 0f); } else { animTACArm.SetFloat(x.NameNeg, x.GetNegativeLimit(), 0f, 0f); animTACArm.SetFloat(x.NamePos, 0, 0f, 0f); } } }