예제 #1
0
        void add_snap_source(Vector3 vPosition, string name, SnapSet targets)
        {
            fMeshGameObject go = AppendMeshGO(name,
                                              UnityUtil.GetPrimitiveMesh(PrimitiveType.Sphere), srcMaterial, gizmo);

            go.SetLocalScale(0.5f * Vector3f.One);
            Frame3f sourceFrame = new Frame3f(vPosition);

            UnityUtil.SetGameObjectFrame(go, sourceFrame, CoordSpace.ObjectCoords);
            Widgets[go] = new SnapDragSourceWidget(this, this.parentScene, targets)
            {
                RootGameObject = go, StandardMaterial = srcMaterial, HoverMaterial = srcHoverMaterial,
                SourceFrameL   = sourceFrame
            };
        }
예제 #2
0
        override protected void BuildGizmo()
        {
            gizmo.SetName("PositionConstrainedGizmo");

            make_materials();

            centerGO = AppendMeshGO("object_origin",
                                    UnityUtil.GetPrimitiveMesh(PrimitiveType.Sphere), srcMaterial, gizmo);
            centerGO.SetLocalScale(WidgetScale);

            Widgets[centerGO] = new PositionConstrainedPointWidget(this, this.parentScene)
            {
                RootGameObject = centerGO, StandardMaterial = srcMaterial, HoverMaterial = srcHoverMaterial
            };

            gizmo.Hide();
        }
예제 #3
0
        public void Create(SOMaterial useMaterial, fGameObject parent, int nLayer = -1)
        {
            if (curve == null)
            {
                curve = new DCurve3();
            }
            axis = Frame3f.Identity;

            meshObject = GameObjectFactory.CreateMeshGO("revolve_preview");
            meshObject.SetMaterial(MaterialUtil.ToMaterialf(useMaterial), true);
            if (nLayer != -1)
            {
                meshObject.SetLayer(nLayer);
            }

            bUpdatePending = true;

            meshObject.SetParent(parent, false);
            meshObject.SetLocalScale(1.001f * Vector3f.One);
        }