"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Activate and Deactivate Trigger

I have two GameObject, One with an Activate Trigger and the other One with a Deactivate Trigger. My 3D Object have a SmoothLookAt script to look at the camera, when the camera Activate Trigger the 3D object start to follow the camera, then the camera goes to the Deactivate Trigger then the 3D object stop right on the position where the camera touch the GameObject with the Deactivate Trigger.I need that when the camera touch the Deactivate Trigger, the 3D object goes back to their original position, and not stays looking beside. How can i figure that.

 

 

  1. here is the script attach to the GabeObject Deactivate Trigger. I need the 3D object goes back to their original position, and not stays looking beside.using UnityEngine;public class ActivateTrigger : MonoBehaviour {public enum Mode {Trigger = 0, // Just broadcast the action on to the targetReplace = 1, // replace target with sourceActivate = 2, // Activate the target GameObjectEnable = 3, // Enable a componentAnimate = 4, // Start animation on targetDeactivate= 5 // Decativate target GameObject}/// The action to accomplishpublic Mode action = Mode.Activate;/// The game object to affect. If none, the trigger work on this game objectpublic Object target;public GameObject source;public int triggerCount = 1;///public bool repeatTrigger = false;void DoActivateTrigger () {triggerCount--;if (triggerCount == 0 || repeatTrigger) {Object currentTarget = target != null ? target : gameObject;Behaviour targetBehaviour = currentTarget as Behaviour;GameObject targetGameObject = currentTarget as GameObject;if (targetBehaviour != null)targetGameObject = targetBehaviour.gameObject;switch (action) {case Mode.Trigger:targetGameObject.BroadcastMessage ("DoActivateTrigger");break;case Mode.Replace:if (source != null) {Object.Instantiate (source, targetGameObject.transform.position, targetGameObject.transform.rotation);DestroyObject (targetGameObject);}break;case Mode.Activate:targetGameObject.active = true;break;case Mode.Enable:if (targetBehaviour != null)targetBehaviour.enabled = true;break;case Mode.Animate:targetGameObject.animation.Play ();break;case Mode.Deactivate:targetGameObject.active = false;break;}}}void OnTriggerEnter (Collider other) {DoActivateTrigger ();}}