// 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); }
public static SmoothCockpitTracker Enable(Cockpit cp) { SmoothCockpitTracker tracker = new SmoothCockpitTracker(); cp.CustomTracker = tracker; cp.PositionMode = Cockpit.MovementMode.CustomTracking; return(tracker); }