예제 #1
0
        // creates a button in the desired geometry shape
        public void Create(SmoothCockpitTracker tracker, Cockpit cockpit)
        {
            this.tracker = tracker;
            this.cockpit = cockpit;

            fGameObject cockpitGO = cockpit.RootGameObject;
            Frame3f     cockpitF  = cockpitGO.GetWorldFrame();

            matFixed       = MaterialUtil.CreateStandardMaterialF(ColorUtil.ForestGreen);
            matTracking    = MaterialUtil.CreateStandardMaterialF(ColorUtil.SelectionGold);
            matHover       = MaterialUtil.CreateStandardMaterialF(ColorUtil.Lighten(ColorUtil.ForestGreen, 0.1f));
            matLocked      = MaterialUtil.CreateStandardMaterialF(ColorUtil.CgRed);
            matLockedHover = MaterialUtil.CreateStandardMaterialF(ColorUtil.Lighten(ColorUtil.CgRed, 0.1f));


            indicator = UnityUtil.CreatePrimitiveGO("tracking_indicator", UnityEngine.PrimitiveType.Capsule, matFixed, true);
            MaterialUtil.DisableShadows(indicator);
            UnityUtil.SetLayerRecursive(indicator, FPlatform.HUDLayer);
            indicator.SetLocalScale(0.025f * Vector3f.One);
            indicator.RotateD(Vector3f.AxisZ, 90.0f);
            Vector3f vDir = (1.0f * cockpitF.Z - 1.0f * cockpitF.Y).Normalized;

            indicator.SetPosition(cockpitF.Origin + IndicatorDistance * vDir);

            AppendExistingGO(indicator);

            //indicator.transform.SetParent(cockpit.RootGameObject.transform, true);
        }
예제 #2
0
        public TwoPointFaceSelectionTool(FScene scene, DMeshSO target) : base(scene)
        {
            TargetSO    = target;
            indicators  = new ToolIndicatorSet(this, scene);
            have_source = have_extent = false;

            selection_valid = false;

            selectionCache = new MeshFaceSelectionCache(target.Mesh);
            selectionCache.ChunkMeshMaterial = MaterialUtil.CreateStandardMaterialF(Colorf.Gold);

            targetTrackingGO = GameObjectFactory.CreateTrackingGO("track_target", target.RootGameObject);
            scene.TransientObjectsParent.AddChild(targetTrackingGO, false);
            selectionCache.ChunkMeshParent = targetTrackingGO;
        }