protected void build_geometry(SceneObject so, List <ISnapSegment> segments) { int nNoClipLayer = FPlatform.WidgetOverlayLayer; // we re-use this class to generate snap points for non-SnapSet use, and in // those cases we don't want to build gameobjects/etc if (EnableGeometry) { foreach (var p in segments) { StandardSnapSegment pg = p as StandardSnapSegment; Frame3f centerW = so.GetScene().ToWorldFrame(pg.center); float extentW = so.GetScene().ToWorldDimension(pg.extent); // only add always-hidden points to overlay layer (other points are z-clipped) //pg.Build(worldFrame, parent, (pg.IsSurface) ? visibleMaterial : hiddenMaterial); //if (pg.IsSurface == false) // pg.primGO.SetLayer(nNoClipLayer); // always add all points to overlay layer pg.Build(centerW, extentW, parent, visibleMaterial, nNoClipLayer); } // have to attach our root object to Scene, otherwise it won't move UnityUtil.AddChild(so.GetScene().RootGameObject, parent, true); } }
public void Build(Frame3f worldFrame, GameObject parent, Material mat, int nLayer = -1) { primGO = UnityUtil.CreatePrimitiveGO("generated_point", PrimitiveType.Sphere, mat, true); UnityUtil.SetGameObjectFrame(primGO, worldFrame, CoordSpace.WorldCoords); MaterialUtil.DisableShadows(primGO); UnityUtil.AddChild(parent, primGO, true); if (nLayer > 0) { primGO.SetLayer(nLayer); } }
public void Build(Frame3f centerW, float extentW, GameObject parent, Material mat, int nLayer = -1) { lineGO = new GameObject("snap_line"); LineRenderer ren = lineGO.AddComponent <LineRenderer>(); ren.startWidth = ren.endWidth = 0.05f; ren.material = mat; ren.useWorldSpace = false; ren.positionCount = 2; ren.SetPosition(0, centerW.Origin - extentW * centerW.Z); ren.SetPosition(1, centerW.Origin + extentW * centerW.Z); MaterialUtil.DisableShadows(lineGO); UnityUtil.AddChild(parent, lineGO, false); if (nLayer > 0) { lineGO.SetLayer(nLayer); } }