// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { try { SSRP_context_element_controller child_controller = hit.transform.GetComponent <SSRP_context_element_controller>(); //child_controller.importData(entityData); child_controller.isClosed = !child_controller.isClosed; Debug.Log("click"); } catch { } if (hit.transform.name == "Player") { Debug.Log("This is a Player"); } else { Debug.Log("This isn't a Player"); } } } }
// Use this for initialization void Start() { boss = PersistantManager.Instance; context_controller = null; if (ContextCanvasGameObject != null) { context_controller = ContextCanvasGameObject.GetComponent <SSRP_context_element_controller>(); } }
public void importData(SSRP_contextResponse response) { boss = PersistantManager.Instance; if (ContextCanvasGameObject != null) { context_controller = ContextCanvasGameObject.GetComponent <SSRP_context_element_controller>(); } if (context_controller != null) { context_controller.importData(response); } else { boss.hud.addText("context response import is not set to entity canvas"); } }
PersistantManager boss;// = PersistantManager.Instance; public void OnInputClicked(InputClickedEventData eventData) { boss = PersistantManager.Instance; // Increase the scale of the object just as a response. //gameObject.transform.localScale += 0.05f * gameObject.transform.localScale; try { SSRP_context_element_controller contextElement = gameObject.transform.GetComponent <SSRP_context_element_controller>(); contextElement.isClosed = !contextElement.isClosed; eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers. } catch { boss = PersistantManager.Instance; boss.hud.addText("Object has no SSRP_context_element_controller to Open/Close "); boss.hud.addText("Go look for A sensesmart logo "); } }
public void hitDetection(Ray ray, string device = "") { RaycastHit hit; if (Physics.Raycast(ray, out hit)) { string name = hit.transform.name; //boss.hud.addText("MouseClick hit"); SSRP_context_element_controller child_controller = null; try { child_controller = hit.transform.GetComponent <SSRP_context_element_controller>(); //child_controller.importData(entityData); } catch { } if (child_controller == null) { boss.hud.addText("no SSRP_context_element_controller found on " + name + " from " + device + " iteraction "); boss.hud.addText("Go look for A sensesmart logo "); return; } else { child_controller.isClosed = !child_controller.isClosed; if (child_controller.isClosed) { boss.hud.addText("Closed Sensor Data Panel" + name); } else { boss.hud.addText("Open Sensor Data Panel " + name); } } } else { boss.hud.addText(" no raycast hit from " + device); } }
public void renderEntities() { if (contextEntityViewGameObject) { Vector3 pos = new Vector3(0f, 0f, 0f); // loop through list of Child data and generate their UI foreach (SSRP_contextResponse entityReponse in distanceSorted[0]) { GameObject data_MVC; data_MVC = (GameObject)Instantiate(contextEntityViewGameObject, pos, Quaternion.identity); //data_MVC.transform.SetParent(contextEntityViewGameObject.transform, false); prefabChildList.Add(data_MVC); SSRP_context_element_controller child_controller = data_MVC.GetComponent <SSRP_context_element_controller>(); child_controller.importData(entityReponse); } } }
public void hitDetection(Ray ray, string device = "") { RaycastHit hit; if (Physics.Raycast(ray, out hit)) { //boss.hud.addText("MouseClick hit"); try { SSRP_context_element_controller child_controller = hit.transform.GetComponent <SSRP_context_element_controller>(); //child_controller.importData(entityData); child_controller.isClosed = !child_controller.isClosed; //boss.hud.addText("hit child_controller found "); } catch { boss.hud.addText("no script found on " + device + " iteraction "); } /* * if (hit.transform.name == "SSRP_context_element_view") * { * boss.hud.addText("hit SSRP_context_element_view "); * } * else * { * boss.hud.addText("hit.transform.name == " + hit.transform.name); * } * // */ } else { boss.hud.addText(" no raycast hit from " + device); } }
void LoadDataSet() { boss = PersistantManager.Instance; //Vuforia.ImageTarget; boss.hud.addText("LoadDataSet"); ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (objectTracker == null) { boss.hud.addText("error : TrackerManager.Instance.GetTracker<ObjectTracker>() == null"); return; } DataSet dataSet = objectTracker.CreateDataSet(); if (dataSet.Load(dataSetName)) { objectTracker.Stop(); // stop tracker so that we can add new dataset if (!objectTracker.ActivateDataSet(dataSet)) { // Note: ImageTracker cannot have more than 100 total targets activated //Debug.Log("<color=yellow>Failed to Activate DataSet: " + dataSetName + "</color>"); boss.hud.addText("Failed to Activate DataSet: " + dataSetName); } if (!objectTracker.Start()) { //Debug.Log("<color=yellow>Tracker Failed to Start.</color>"); boss.hud.addText("Tracker Failed to Start. " + dataSetName); } int counter = 0; foreach (Trackable trackObj in dataSet.GetTrackables()) { Debug.Log("dataSet [" + dataSetName + "]:" + trackObj.Name); //boss.hud.addText(trackObj.Name); } foreach (SSRP_contextResponse cr in contextElement_currentList) { Debug.Log("cr:" + cr.marker_name); } IEnumerable <TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); foreach (TrackableBehaviour tb in tbs) { SSRP_contextResponse hit_response = null; if (contextElement_currentList != null) { foreach (SSRP_contextResponse cr in contextElement_currentList) { if (tb.TrackableName == cr.marker_name) { hit_response = cr; } } } if (hit_response != null && tb.name == "New Game Object") { //importData //SSRP_ContextElement el = // change generic name to include trackable name tb.gameObject.name = ++counter + ":DynamicImageTarget-" + tb.TrackableName; // add additional script components for trackable tb.gameObject.AddComponent <DefaultTrackableEventHandler>(); tb.gameObject.AddComponent <TurnOffBehaviour>(); if (augmentationObject != null) { // instantiate augmentation object and parent to trackable GameObject aug_anchor = (GameObject)GameObject.Instantiate(augmentationAnchor); aug_anchor.transform.SetParent(tb.gameObject.transform); aug_anchor.transform.localPosition = Vector3.zero; aug_anchor.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); aug_anchor.transform.localScale = new Vector3(0.275f, 0.275f, 0.275f); // instantiate augmentation object and parent to trackable GameObject aug_obj = (GameObject)GameObject.Instantiate(augmentationObject); aug_obj.transform.SetParent(aug_anchor.transform); aug_obj.transform.localPosition = new Vector3(0f, 1.75f, 0f); aug_obj.transform.localRotation = Quaternion.identity; aug_obj.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); SSRP_context_element_controller aug_obj_script = aug_obj.GetComponent <SSRP_context_element_controller>(); if (aug_obj_script != null) { aug_obj_script.importData(hit_response); } // */ aug_obj.gameObject.SetActive(true); } else { //Debug.Log("<color=yellow>Warning: No augmentation object specified for: " + tb.TrackableName + "</color>"); boss.hud.addText("No augmentation object specified for: " + tb.TrackableName); } } } } else { //Debug.LogError("<color=yellow>Failed to load dataset: '" + dataSetName + "'</color>"); boss.hud.addText("Failed to load dataset: '" + dataSetName + "'"); } }