// // Boilerplate stuff // virtual protected void onTransformModified(SceneObject so) { // keep widget synced with object frame of target Frame3f widgetFrame = targetWrapper.GetLocalFrame(CoordSpace.ObjectCoords); gizmo.SetLocalPosition(widgetFrame.Origin); gizmo.SetLocalRotation(widgetFrame.Rotation); }
// creates a button that is just the mesh public void Create(fMesh mesh, fMaterial meshMaterial, float fScale, Quaternionf transform) { button = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDButton")); iconMesh = AppendMeshGO("shape", mesh, meshMaterial, button); iconMesh.SetLocalScale(new Vector3f(fScale, fScale, fScale)); iconMesh.SetLocalRotation(iconMesh.GetLocalRotation() * transform); MaterialUtil.DisableShadows(iconMesh); standard_mat = new fMaterial(meshMaterial); }
// creates a button with a background shape and a foreground mesh public void Create(fMaterial bgMaterial, fMesh mesh, fMaterial meshMaterial, float fScale, Frame3f deltaF) { 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 = AppendMeshGO("shape", mesh, meshMaterial, button); iconMesh.SetLocalScale(new Vector3f(fScale, fScale, fScale)); iconMesh.SetLocalPosition(deltaF.Origin); iconMesh.SetLocalRotation(deltaF.Rotation); MaterialUtil.DisableShadows(iconMesh); standard_mat = new fMaterial(bgMaterial); }
// creates a button that is just the mesh, basically same as above but without the background disc public void Create(UnityEngine.PrimitiveType eType, fMaterial primMaterial, float fPrimScale = 1.0f) { button = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDButton")); buttonMesh = AppendUnityPrimitiveGO(UniqueNames.GetNext("HUDButton"), eType, primMaterial, button); float primSize = Shape.EffectiveRadius() * fPrimScale; buttonMesh.SetLocalScale(new Vector3f(primSize, primSize, primSize)); buttonMesh.Translate(new Vector3f(0.0f, 0.0f, -primSize), false); Quaternionf rot = buttonMesh.GetLocalRotation(); rot = rot * Quaternionf.AxisAngleD(Vector3f.AxisY, 45.0f); rot = rot * Quaternionf.AxisAngleD(Vector3f.AxisX, -15.0f); buttonMesh.SetLocalRotation(rot); //buttonMesh.transform.Rotate(-15.0f, 45.0f, 0.0f, Space.Self); MaterialUtil.DisableShadows(buttonMesh); standard_mat = new fMaterial(primMaterial); }