// creates a button with a floating primitive in front of the button shape public void Create(PrimitiveType eType, Material bgMaterial, Material primMaterial, float fPrimScale = 0.7f) { button = new GameObject(UniqueNames.GetNext("HUDButton")); buttonMesh = AppendMeshGO("disc", make_button_body_mesh(), bgMaterial, button); buttonMesh.transform.Rotate(Vector3.right, -90.0f); // ?? MaterialUtil.DisableShadows(buttonMesh); GameObject prim = AppendUnityPrimitiveGO("primitive", eType, primMaterial, button); float primSize = Shape.EffectiveRadius() * fPrimScale; prim.transform.localScale = new Vector3(primSize, primSize, primSize); prim.transform.Translate(0.0f, 0.0f, -primSize); prim.transform.Rotate(-15.0f, 45.0f, 0.0f, Space.Self); MaterialUtil.DisableShadows(prim); standard_mat = new fMaterial(bgMaterial); }
// creates a button with a floating primitive in front of the button shape public void Create(UnityEngine.PrimitiveType eType, fMaterial bgMaterial, fMaterial primMaterial, float fPrimScale = 0.7f) { button = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDButton")); buttonMesh = AppendMeshGO("shape", HUDUtil.MakeBackgroundMesh(this.Shape), bgMaterial, button); buttonMesh.RotateD(Vector3f.AxisX, -90.0f); // ?? MaterialUtil.DisableShadows(buttonMesh); iconMesh = AppendUnityPrimitiveGO("primitive", eType, primMaterial, button); float primSize = Shape.EffectiveRadius() * fPrimScale; iconMesh.SetLocalScale(new Vector3f(primSize, primSize, primSize)); iconMesh.Translate(new Vector3f(0.0f, 0.0f, -primSize), false); Quaternionf rot = iconMesh.GetLocalRotation(); rot = rot * Quaternionf.AxisAngleD(Vector3f.AxisY, 45.0f); rot = rot * Quaternionf.AxisAngleD(Vector3f.AxisX, -15.0f); iconMesh.SetLocalRotation(rot); //buttonMesh.transform.Rotate(-15.0f, 45.0f, 0.0f, Space.Self); MaterialUtil.DisableShadows(iconMesh); standard_mat = new fMaterial(bgMaterial); }