Esempio n. 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);
        }
Esempio n. 2
0
        fPolylineGameObject allocate_polyline_go()
        {
            fPolylineGameObject go = GameObjectFactory.CreatePolylineGO(
                "gcode_path", new List <Vector3f>(), CCMaterials.PathMaterial_Default, true, 1.0f, LineWidthType.World);

            go.SetCornerQuality(fCurveGameObject.CornerQuality.Minimal);
            MaterialUtil.DisableShadows(go);
            return(go);
        }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        //GameObject trailGO;
        //TrailRenderer trailRen;

        public PrintTempParticleSystem(GameObject parentGO)
        {
            heatParticlesGO = new GameObject("heatParticleSystem");
            ps = heatParticlesGO.AddComponent <ParticleSystem>();
            parentGO.AddChild(heatParticlesGO, false);

            Material heatMat = MaterialUtil.SafeLoadMaterial("HeatParticleMaterial");

            heatParticlesGO.GetComponent <ParticleSystemRenderer>().material =
                heatMat;
            //MaterialUtil.SafeLoadMaterial("Particles/Alpha Blended Premultiply");
            heatParticlesGO.SetLayer(FPlatform.WidgetOverlayLayer);
            heatParticlesGO.GetComponent <Renderer>().material.renderQueue = 4000;
            MaterialUtil.DisableShadows(heatParticlesGO);

            ps.Stop();


            sparksGO = UnityUtil.FindGameObjectByName("SparksPS");
            sparksGO.SetVisible(true);
            sparksPS = sparksGO.GetComponent <ParticleSystem>();
            sparksPS.Stop();
            parentGO.AddChild(sparksGO, false);


            fMaterial mat = MaterialUtil.CreateFlatMaterial(Colorf.VideoRed, 0.75f);

            trailGO = GameObjectFactory.CreatePolylineGO("trail", new List <Vector3f>(), mat, true, 0.5f, LineWidthType.World);
            trailGO.GetComponent <Renderer>().material.renderQueue = 3500;
            trailGO.SetCornerQuality(fCurveGameObject.CornerQuality.Minimal);
            trailGO.SetParent(parentGO);
            trailGO.SetLayer(FPlatform.WidgetOverlayLayer);
            MaterialUtil.DisableShadows(trailGO);

            //trailGO = new GameObject("heatTrail");
            //trailRen = trailGO.AddComponent<TrailRenderer>();
            //parentGO.AddChild(trailGO, false);

            //trailRen.material = MaterialUtil.CreateFlatMaterial(Colorf.VideoRed);
            //trailRen.material.renderQueue = 3500;
            //trailRen.minVertexDistance = 0.2f;
            //trailRen.numCornerVertices = 4;
            //trailRen.startWidth = 0.5f;
            //trailRen.endWidth = 0.1f;

            //trailRen.time = 2.0f;
        }
Esempio n. 5
0
        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);
            }
        }