public static VoxelPlaneCollision DoRayCastFromHashEntryToPlane(DetectedPlaneVisualizer newPlane, HashEntry hashEntry) { //RaycastHit hit; //int layer_mask = LayerMask.GetMask("Plane"); if (newPlane.GetChildCollider().bounds.Contains(hashEntry.position)) { return(VoxelPlaneCollision.INSIDE); } // Separate the point a bit from the object based on the scale of it // float distance = (hashEntry.voxel.gameObject.transform.localScale + 0.01f); // Vector3 newPoint_neg = distance * (-1 * newPlane.m_planeNormal) + hashEntry.position; // Vector3 newPoint_pos = distance * (newPlane.m_planeNormal) + hashEntry.position; /*if (Physics.Raycast(hashEntry.position, -1 * newPlane.m_planeNormal, out hit, MAX_PLANE_DISTANCE, layer_mask)) { * return VoxelPlaneCollision.DOWN; * } * * if (Physics.Raycast(hashEntry.position, newPlane.m_planeNormal, out hit, MAX_PLANE_DISTANCE, layer_mask)) { * return VoxelPlaneCollision.UP; * }*/ return(VoxelPlaneCollision.NONE); }
public void onInitiated(DetectedPlaneVisualizer newLayer) { // if (floorLayer == null || newLayer.center.y < floorLayer.center.y) { // floorLayer = newLayer; // newLayer.setFloor(true); // } // LayerVisualizers.Add(newLayer); }
public void OnTogglePlanes(bool flag) { foreach (GameObject plane in GameObject.FindGameObjectsWithTag("Plane")) { Renderer r = plane.GetComponent <Renderer>(); DetectedPlaneVisualizer t = plane.GetComponent <DetectedPlaneVisualizer>(); r.enabled = flag; t.enabled = flag; } }
void stopShowingPlanes() { foreach (GameObject plane in GameObject.FindGameObjectsWithTag("Plane")) { Renderer r = plane.GetComponent <Renderer>(); DetectedPlaneVisualizer t = plane.GetComponent <DetectedPlaneVisualizer>(); //t.disableMesh(); r.enabled = false; t.enabled = false; } }
private void Update() { // Only update if session is tracking if (Session.Status != SessionStatus.Tracking) { return; } Session.GetTrackables(newDetectedPlanes, TrackableQueryFilter.New); foreach (DetectedPlane newPlane in newDetectedPlanes) { DetectedPlaneVisualizer planeVisualizer = Instantiate(detectedPlanePrefab, Vector3.zero, Quaternion.identity, transform); planeVisualizer.Initialize(newPlane); detectedPlanes.Add(planeVisualizer.gameObject); } }
private void hidePlanesAfterFirstHit() { //List<DetectedPlane> temp = new List<DetectedPlane>(); //Session.GetTrackables<DetectedPlane>(temp); //foreach (var plane in temp) //{ // //planeX = plane.ExtentX; // //planeZ = plane.ExtentZ; //} // Hide display of detected planes (planes are still tracked in the background) foreach (GameObject plane in GameObject.FindGameObjectsWithTag("DetectedPlaneTag")) { Renderer r = plane.GetComponent <Renderer>(); DetectedPlaneVisualizer t = plane.GetComponent <DetectedPlaneVisualizer>(); r.enabled = false; t.enabled = false; } }
void Update() { if (Session.Status != SessionStatus.Tracking) { return; } Session.GetTrackables <DetectedPlane>(_newPlanes, TrackableQueryFilter.New); for (int i = 0; i < _newPlanes.Count; i++) { GameObject planeObject = Instantiate(PlanePrefab, Vector3.zero, Quaternion.identity, transform); DetectedPlaneVisualizer visualizer = planeObject.GetComponent <DetectedPlaneVisualizer>(); if (visualizer != null) { visualizer.Initialize(_newPlanes[i]); _allPlanes.Add(visualizer); visualizer.MeshRenderer.enabled = ShouldShowVisualizer; } } }
void Start() { QuitOnConnectionErrors(); _planeGen = GetComponent <DetectedPlaneGenerator>(); _planeVis = GetComponent <DetectedPlaneVisualizer>(); }
public void DestroyPlaneRenderer(DetectedPlaneVisualizer planeVisualizer) { _allPlanes.Remove(planeVisualizer); Destroy(planeVisualizer.gameObject); }