private void GenerateWater() { if (radius > maximumRaidus) { radius = maximumRaidus; } if (waterGameObject != null) { Destroy(waterGameObject); } var thickness = radius - holeSize; var mesh = ShapeGenerator.GeneratePipe(PivotLocation.Center, radius, pipeHeight, thickness, pipeSubdivAxis, pipeSubdivHeight); var meshRenderer = mesh.GetComponent <MeshRenderer>(); meshRenderer.sharedMaterial = waterMaterial; mesh.transform.SetParent(transform, false); waterGameObject = mesh.gameObject; // adjust the y-value of the gameobject // by removing the pipeHeight from the y-axis the wall cutoff looks right from the get go // DEBUG: remove elevation var pos = new Vector3(arCamera.transform.position.x, groundPlane.transform.position.y + elevation - pipeHeight, arCamera.transform.position.z); //var pos = new Vector3(arCamera.transform.position.x, groundPlane.transform.position.y - pipeHeight, arCamera.transform.position.z); waterGameObject.transform.SetPositionAndRotation(pos, Quaternion.identity); }
public override ProBuilderMesh Build(bool preview = false) { return(ShapeGenerator.GeneratePipe( EditorUtility.newShapePivotLocation, s_Radius, s_Height, s_Thickness, s_AxisSegments, s_HeightSegments )); }