private int lastLod; // Track when the lod has been changed private void Start() { if (!characterRoot) { characterRoot = gameObject; } if (characterRoot) { // Get RandomEyes3D reference from the character root res = characterRoot.GetComponents <RandomEyes3D>(); for (int i = 0; i < res.Length; i++) { if (res[i].useCustomShapesOnly) { reCustomShapes = res[i]; } } // Get CM_AutoDeskSync reference from the character root autodeskSync = characterRoot.GetComponent <CM_AutodeskSync>(); if (autodeskSync) { GetCroudLOD(); GetLowLOD(); GetMidLOD(); GetHighLOD(); } } }
/// <summary> /// Get the RandomEyes3D component /// </summary> public void GetRandomEyes3D() { if (!randomEyes3D) { randomEyes3D = GetComponent <RandomEyes3D>(); } }
void Start() { if (!randomEyes3D) { randomEyes3D = GetComponent<RandomEyes3D>(); } }
public void NewGazeTarget(HeadLookController headlook, GameObject newTarget) { headlook.target = newTarget.transform.position; randomEyesComp = headlook.gameObject.GetComponent <RandomEyes3D>(); randomEyesComp.lookTarget = newTarget; randomEyesComp.lookTargetTracking = newTarget; }
void Start() { if (!randomEyes3D) { randomEyes3D = GetComponent <RandomEyes3D>(); } }
void Update() { // Add the components when checked and not already loaded if (loadSalsaAndRandomEyes && !salsa3D && !re3D) { // Salsa3D gameObject.AddComponent <Salsa3D>(); // Add a Salsa3D component salsa3D = GetComponent <Salsa3D>(); // Get reference to the Salsa3D component salsa3D.skinnedMeshRenderer = GetComponent <SkinnedMeshRenderer>(); // Link the SkinnedMeshRenderer salsa3D.saySmallIndex = 0; // Set saySmall BlendShape index salsa3D.sayMediumIndex = 1; // Set sayMedium BlendShape index salsa3D.sayLargeIndex = 2; // Set sayLarge BlendShape index salsa3D.SetAudioClip(audioClip); // Set AudioClip // Or set the AudioClip from a clip in any Resources folder //salsa3D.SetAudioClip((Resources.Load("EthanEcho0", typeof(AudioClip)) as AudioClip)); salsa3D.saySmallTrigger = 0.002f; // Set the saySmall amplitude trigger salsa3D.sayMediumTrigger = 0.004f; // Set the sayMedium amplitude trigger salsa3D.sayLargeTrigger = 0.006f; // Set the sayLarge amplitude trigger salsa3D.audioUpdateDelay = 0.08f; // Set the amplitutde sample update delay salsa3D.blendSpeed = 10f; // Set the blend speed salsa3D.rangeOfMotion = 100f; // Set the range of motion salsa3D.broadcast = true; // Enable talk event broadcasts salsa3D.broadcastReceivers = new GameObject[1]; // Creat a new array of broadcast receivers salsa3D.broadcastReceivers[0] = broadcastReciever; // Link to a GameObject setup to listen for SALSA talk events salsa3D.expandBroadcast = true; // Expand the broadcast recievers array in the inspector salsa3D.Play(); // Begin lip sync // RandomEyes3D gameObject.AddComponent <RandomEyes3D>(); // Add a RandomEyes3D component re3D = GetComponent <RandomEyes3D>(); // Get reference to the RandomEyes3D component re3D.skinnedMeshRenderer = GetComponent <SkinnedMeshRenderer>(); // Link the SkinnedMeshRenderer re3D.lookUpIndex = 3; // Set the lookUp BlendShape index re3D.lookDownIndex = 4; // Set the lookDown BlendShape index re3D.lookLeftIndex = 5; // Set the lookLeft BlendShape index re3D.lookRightIndex = 6; // Set the lookRight BlendShape index re3D.blinkIndex = 7; // Set the blink BlendShape index re3D.rangeOfMotion = 100f; // Set the eyes range of motion re3D.blendSpeed = 10f; // Set the eyes blend speed re3D.blinkDuration = 0.05f; // Set the blink duration re3D.blinkSpeed = 20f; // Set the blink speed re3D.SetOpenMax(0f); // Set the max eye open position, 0=max re3D.SetCloseMax(100f); // Set the max eye close position, 100=max re3D.SetRandomEyes(true); // Enable random eye movement re3D.SetBlink(true); // Enable random blink re3D.AutoLinkCustomShapes(true, salsa3D); // Automatically link all available BlendShapes while excluding eye and mouth shapes re3D.expandCustomShapes = true; // Expand the custom shapes array in the inspector re3D.broadcastCS = true; // Enable cust shape event broadcasts re3D.broadcastCSReceivers = new GameObject[1]; // Creat a new array of broadcast receivers re3D.broadcastCSReceivers[0] = GameObject.Find("Broadcasts"); // Link to a GameObject setup to listen for RandomEyes custom shape events re3D.expandBroadcastCS = true; // Expand the broadcast recievers array in the inspector } }
private int yHeight = 30; // The X width of GUI buttons /// <summary> /// On start, try to get a local reference to the RandomEyes3D class and the scene camera /// </summary> void Start() { if (!randomEyes3D) // randomEyes3D is null { randomEyes3D = (RandomEyes3D)FindObjectOfType(typeof(RandomEyes3D)); // Try to get a local reference to RandomEyes3D } if (!mainCam) // mainCam is null { mainCam = (Camera)FindObjectOfType(typeof(Camera)); // Try to get a local reference to the scene camera } targetPosHome = target.transform.position; }
/// <summary> /// Get reference to a RandomEyes component /// </summary> void Start() { randomEyes2D = GetComponent <RandomEyes2D>(); if (randomEyes2D) { randomEyes = randomEyes2D.gameObject; } randomEyes3D = GetComponent <RandomEyes3D>(); if (randomEyes3D) { randomEyes = randomEyes3D.gameObject; } }
/// <summary> /// Get reference to a RandomEyes component /// </summary> void Start() { randomEyes2D = GetComponent<RandomEyes2D>(); if (randomEyes2D) { randomEyes = randomEyes2D.gameObject; } randomEyes3D = GetComponent<RandomEyes3D>(); if (randomEyes3D) { randomEyes = randomEyes3D.gameObject; } }
/// <summary> /// Get the RandomEyes3D component /// </summary> public void GetRandomEyes3D() { //if (!randomEyes3D) randomEyes3D = GetComponent<RandomEyes3D>(); RandomEyes3D[] randomEyes = GetComponents <RandomEyes3D>(); if (randomEyes.Length > 1) { for (int i = 0; i < randomEyes.Length; i++) { // Verify this instance ID does not match the reEyes instance ID if (!randomEyes[i].useCustomShapesOnly) { // Set the reShapes instance randomEyes3D = randomEyes[i]; } } } }
void Start() { clipDir = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf("/")) + "/lib/wavs/"; //clipDir = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf("/")) + "/wavs/"; txtDir = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf("/")) + "/wavname.txt"; oldTime = File.GetLastWriteTimeUtc(txtDir); txtfile = new WWW("file://" + txtDir); while (!txtfile.isDone) { } ; char ucode = '\u4e2d'; anim = GetComponent <Animator>(); eyes = GetComponent <RandomEyes3D>(); eyes.SetLookTarget(cam); makeSalsa(txtfile.text); }
/// <summary> /// Get the RandomEyes3D component /// </summary> public void GetRandomEyes3D() { //if (!randomEyes3D) randomEyes3D = GetComponent<RandomEyes3D>(); RandomEyes3D[] randomEyes = GetComponents <RandomEyes3D>(); if (randomEyes.Length > 1) { for (int i = 0; i < randomEyes.Length; i++) { // Get RandomEyes3D expression instance if (randomEyes[i].useCustomShapesOnly) { reExpression = randomEyes[i]; } else // Get RandomEyes3D eyes instance { reEyes = randomEyes[i]; } } } }
/// <summary> /// Get the RandomEyes3D component /// </summary> public void GetRandomEyes3D() { RandomEyes3D[] randomEyes = GetComponents <RandomEyes3D>(); if (randomEyes.Length == 1) { re3DEyes = randomEyes[0]; } else if (randomEyes.Length > 1) { for (int i = 0; i < randomEyes.Length; i++) { // Link the expression instance if (randomEyes[i].useCustomShapesOnly) { re3DExpressions = randomEyes[i]; } else // Link the eyes instance { re3DEyes = randomEyes[i]; } } } }
void Update() { // Add the components when checked and not already loaded if (loadSalsaAndRandomEyes && !salsa3D && !re3D) { // Salsa3D gameObject.AddComponent<Salsa3D>(); // Add a Salsa3D component salsa3D = GetComponent<Salsa3D>(); // Get reference to the Salsa3D component salsa3D.skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>(); // Link the SkinnedMeshRenderer salsa3D.saySmallIndex = 0; // Set saySmall BlendShape index salsa3D.sayMediumIndex = 1; // Set sayMedium BlendShape index salsa3D.sayLargeIndex = 2; // Set sayLarge BlendShape index salsa3D.SetAudioClip(audioClip); // Set AudioClip // Or set the AudioClip from a clip in any Resources folder //salsa3D.SetAudioClip((Resources.Load("EthanEcho0", typeof(AudioClip)) as AudioClip)); salsa3D.saySmallTrigger = 0.002f; // Set the saySmall amplitude trigger salsa3D.sayMediumTrigger = 0.004f; // Set the sayMedium amplitude trigger salsa3D.sayLargeTrigger = 0.006f; // Set the sayLarge amplitude trigger salsa3D.audioUpdateDelay = 0.08f; // Set the amplitutde sample update delay salsa3D.blendSpeed = 10f; // Set the blend speed salsa3D.rangeOfMotion = 100f; // Set the range of motion salsa3D.broadcast = true; // Enable talk event broadcasts salsa3D.broadcastReceivers = new GameObject[1]; // Creat a new array of broadcast receivers salsa3D.broadcastReceivers[0] = broadcastReciever; // Link to a GameObject setup to listen for SALSA talk events salsa3D.expandBroadcast = true; // Expand the broadcast recievers array in the inspector salsa3D.Play(); // Begin lip sync // RandomEyes3D gameObject.AddComponent<RandomEyes3D>(); // Add a RandomEyes3D component re3D = GetComponent<RandomEyes3D>(); // Get reference to the RandomEyes3D component re3D.skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>(); // Link the SkinnedMeshRenderer re3D.lookUpIndex = 3; // Set the lookUp BlendShape index re3D.lookDownIndex = 4; // Set the lookDown BlendShape index re3D.lookLeftIndex = 5; // Set the lookLeft BlendShape index re3D.lookRightIndex = 6; // Set the lookRight BlendShape index re3D.blinkIndex = 7; // Set the blink BlendShape index re3D.rangeOfMotion = 100f; // Set the eyes range of motion re3D.blendSpeed = 10f; // Set the eyes blend speed re3D.blinkDuration = 0.05f; // Set the blink duration re3D.blinkSpeed = 20f; // Set the blink speed re3D.SetOpenMax(0f); // Set the max eye open position, 0=max re3D.SetCloseMax(100f); // Set the max eye close position, 100=max re3D.SetRandomEyes(true); // Enable random eye movement re3D.SetBlink(true); // Enable random blink re3D.broadcast = true; // Enable eye movement event broadcasts re3D.broadcastReceivers = new GameObject[1]; // Creat a new array of broadcast receivers re3D.broadcastReceivers[0] = GameObject.Find("Broadcasts"); // Link to a GameObject setup to listen for RandomEyes look events re3D.expandBroadcast = true; // Expand the broadcast recievers array in the inspector re3D.AutoLinkCustomShapes(true, salsa3D); // Automatically link all available BlendShapes while excluding eye and mouth shapes re3D.expandCustomShapes = true; // Expand the custom shapes array in the inspector re3D.broadcastCS = true; // Enable cust shape event broadcasts re3D.broadcastCSReceivers = new GameObject[1]; // Creat a new array of broadcast receivers re3D.broadcastCSReceivers[0] = GameObject.Find("Broadcasts"); // Link to a GameObject setup to listen for RandomEyes custom shape events re3D.expandBroadcastCS = true; // Expand the broadcast recievers array in the inspector } }
/// <summary> /// On start, try to get a local reference to the RandomEyes3D class and the scene camera /// </summary> void Start() { if (!randomEyes3D) // randomEyes3D is null randomEyes3D = (RandomEyes3D)FindObjectOfType(typeof(RandomEyes3D)); // Try to get a local reference to RandomEyes3D if (!mainCam) // mainCam is null mainCam = (Camera)FindObjectOfType(typeof(Camera)); // Try to get a local reference to the scene camera targetPosHome = target.transform.position; }