Example #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);
        }
Example #2
0
 static void update_printer_bed()
 {
     if (PrinterBed != null)
     {
         float w = (float)Settings.BedSizeXMM;
         float h = (float)Settings.BedSizeYMM;
         if (w > 0 && h > 0)
         {
             PrinterBed.SetLocalScale(new Vector3f(w, 1, h));
         }
     }
 }