29 [Tooltip(
"Thickness to make each plane.")]
31 public float PlaneThickness = 0.01f;
33 [Tooltip(
"Threshold for acceptable normals (the closer to 1, the stricter the standard). Used when determining plane type.")]
35 public float UpNormalThreshold = 0.9f;
37 [Tooltip(
"Buffer to use when determining if a horizontal plane near the floor should be considered part of the floor.")]
39 public float FloorBuffer = 0.1f;
41 [Tooltip(
"Buffer to use when determining if a horizontal plane near the ceiling should be considered part of the ceiling.")]
43 public float CeilingBuffer = 0.1f;
45 [Tooltip(
"Material to use when rendering Wall planes.")]
48 [Tooltip(
"Material to use when rendering floor planes.")]
51 [Tooltip(
"Material to use when rendering ceiling planes.")]
54 [Tooltip(
"Material to use when rendering table planes.")]
57 [Tooltip(
"Material to use when rendering planes of the unknown type.")]
60 [Tooltip(
"Type of plane that the object has been classified as.")]
87 public Vector3 SurfaceNormal {
get;
private set; }
96 return gameObject.GetComponent<Renderer>().enabled;
100 if (IsVisible != value)
102 gameObject.GetComponent<Renderer>().enabled = value;
114 UpdateSurfacePlane();
122 private void UpdateSurfacePlane()
126 SetPlaneMaterialByType();
132 private void SetPlaneGeometry()
138 gameObject.transform.localScale =
new Vector3(extents.x, extents.y, PlaneThickness);
144 private void SetPlaneType()
146 SurfaceNormal = plane.
Plane.normal;
152 if (SurfaceNormal.y >= UpNormalThreshold)
157 if (gameObject.transform.position.y > (floorYPosition + FloorBuffer))
163 else if (SurfaceNormal.y <= -(UpNormalThreshold))
168 if (gameObject.transform.position.y < (ceilingYPosition - CeilingBuffer))
174 else if (Mathf.Abs(SurfaceNormal.y) <= (1 - UpNormalThreshold))
189 private void SetPlaneMaterialByType()
191 Renderer renderer = gameObject.GetComponent<Renderer>();
196 if (FloorMaterial != null)
198 renderer.material = FloorMaterial;
202 if (TableMaterial != null)
204 renderer.material = TableMaterial;
208 if (CeilingMaterial != null)
210 renderer.material = CeilingMaterial;
214 if (WallMaterial != null)
216 renderer.material = WallMaterial;
220 if (UnknownMaterial != null)
222 renderer.material = UnknownMaterial;