public void changeSelectedLabel(PlacementObject selected) { if (string.Equals(selected.getLabel().Trim(), "Emergency")) { selected.SetOverlayText("Low Priority"); selected.gameObject.transform.GetComponent <MeshRenderer>().material.SetColor("_EmissionColor", Color.green); } else if (string.Equals(selected.getLabel().Trim(), "Medium")) { selected.SetOverlayText("Emergency"); selected.gameObject.transform.GetComponent <MeshRenderer>().material.SetColor("_EmissionColor", Color.red); } else if (string.Equals(selected.getLabel().Trim(), "Low Priority")) { selected.SetOverlayText("Medium"); selected.gameObject.transform.GetComponent <MeshRenderer>().material.SetColor("_EmissionColor", Color.yellow); } }
public PlacementObject PlaceObject(Vector3 position, Quaternion rotation, Color color, string priority, string audio, string text, string image) { //ARReferencePoint newAnchor = anchorManager.AddReferencePoint(appStateManager.placementCursorPose); PlacementObject newPlaced = Instantiate(objectToPlace, position, rotation); newPlaced.gameObject.transform.GetComponent <MeshRenderer>().material.SetColor("_EmissionColor", color); newPlaced.SetOverlayText(priority); newPlaced.audioPath = audio; newPlaced.imagePath = image; newPlaced.textPath = text; placementObjects.Add(newPlaced); return(newPlaced); }
void Update() { // do not capture events unless the welcome panel is hidden if (welcomePanel.activeSelf) { return; } if (Input.touchCount > 0) { Touch touch = Input.GetTouch(0); touchPosition = touch.position; if (touch.phase == TouchPhase.Began) { Ray ray = arCamera.ScreenPointToRay(touch.position); RaycastHit hitObject; if (Physics.Raycast(ray, out hitObject)) { PlacementObject placementObject = hitObject.transform.GetComponent <PlacementObject>(); if (placementObject != null) { onTouchHold = isLocked ? false : true; placementObject.SetOverlayText(isLocked ? "AR Object Locked" : "AR Object Unlocked"); } } } if (touch.phase == TouchPhase.Ended) { onTouchHold = false; } } if (arRaycastManager.Raycast(touchPosition, hits, UnityEngine.XR.ARSubsystems.TrackableType.PlaneWithinPolygon)) { Pose hitPose = hits[0].pose; if (placedObject == null) { if (defaultRotation > 0) { placedObject = Instantiate(placedPrefab, hitPose.position, Quaternion.identity); placedObject.transform.Rotate(Vector3.up, defaultRotation); } else { placedObject = Instantiate(placedPrefab, hitPose.position, hitPose.rotation); } } else { if (onTouchHold) { placedObject.transform.position = hitPose.position; if (defaultRotation == 0) { placedObject.transform.rotation = hitPose.rotation; } } } } }