public override void Build(ModuleMaker maker, GameObject root, GameObject head) { GameObject joycon = new GameObject("Joycon Controller"); joycon.transform.parent = root.transform; joycon.transform.localPosition = Vector3.zero; JoyconController controller = joycon.AddComponent <JoyconController>(); JoyconEditorInternals.CreateAxis(JoyconDefaults.StickEntries); JoyconEditorInternals.CreateAxis(JoyconDefaults.ButtonEntries); string assetPath = ModuleMaker.AssetPath + "/Joycon Binding.asset"; JoyconBinding asset = AssetDatabase.LoadAssetAtPath <JoyconBinding>(assetPath); if (asset == null) { asset = ScriptableObject.CreateInstance <JoyconBinding>(); if (this.dpadBindings) { JoyconEditorInternals.CreateAxis(JoyconDefaults.DpadEntries); asset.Add(JoyconDefaults.DpadSchemes); } AssetDatabase.CreateAsset(asset, assetPath); } controller.Binding = asset; }
public override void OnGUI(ModuleMaker maker) { WindowDesignUtility.SectionLabel("Surfaces"); EditorGUILayout.BeginHorizontal(); this.template = (ProjectorTemplate)EditorGUILayout.EnumPopup("Template", this.template); TemplateToSelection(); using (new EditorGUI.DisabledScope(this.template != ProjectorTemplate.Custom)) this.selection = (ProjectorSelection)EditorGUILayout.EnumFlagsField(this.selection); EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); WindowDesignUtility.SectionLabel("Rendering"); this.target = (CameraTarget)EditorGUILayout.EnumPopup("Camera Target", this.target); EditorGUILayout.Separator(); WindowDesignUtility.SectionLabel("Dimensions"); bool wideMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; this.width = EditorGUILayout.FloatField("Width (m)", this.width); this.height = EditorGUILayout.FloatField("Height (m)", this.height); this.length = EditorGUILayout.FloatField("Length (m)", this.length); this.position = EditorGUILayout.Vector3Field("Position", this.position); EditorGUIUtility.wideMode = wideMode; }
public override void OnGUI(ModuleMaker maker) { WindowDesignUtility.SectionLabel("Sensor"); bool wideMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; this.sensorLocation = EditorGUILayout.Vector3Field("Location", this.sensorLocation); EditorGUIUtility.wideMode = wideMode; EditorGUILayout.Separator(); WindowDesignUtility.SectionLabel("Tracking Area"); this.trackingAreaWidth = EditorGUILayout.FloatField("Width (m)", this.trackingAreaWidth); this.trackingAreaLength = EditorGUILayout.FloatField("Length (m)", this.trackingAreaLength); EditorGUILayout.Separator(); WindowDesignUtility.SectionLabel("Trackables"); this.trackableHead = EditorGUILayout.Toggle("Head", this.trackableHead); this.trackableHands = EditorGUILayout.Toggle("Hands", this.trackableHands); }
public override void Build(ModuleMaker maker, GameObject root, GameObject head) { if (string.IsNullOrEmpty(this.name)) { this.name = "Unnamed"; } root.name = this.name; GameObject prefab = PrefabUtility.SaveAsPrefabAsset(root, ModuleMaker.AssetPath + "/" + this.name + ".prefab"); EditorGUIUtility.PingObject(prefab); MonoBehaviour.DestroyImmediate(root); GameObject instance = PrefabUtility.InstantiatePrefab(prefab) as GameObject; Undo.RegisterCreatedObjectUndo(instance, "Instantiate Virtual Environment"); if (this.installSDK) { InstallSDK(); } if (this.exclusiveFullScreen) { PlayerSettings.fullScreenMode = FullScreenMode.ExclusiveFullScreen; } }
public override void OnGUI(ModuleMaker maker) { EditorGUILayout.LabelField("You are almost finished!", EditorStyles.boldLabel); EditorGUILayout.LabelField( "The virtual enviroment will be packed into a Prefab which you can " + "drag and drop to other scenes or projects where the package is installed.", EditorStyles.wordWrappedLabel); EditorGUILayout.Space(); this.name = EditorGUILayout.TextField("Prefab Name", this.name); if (string.IsNullOrEmpty(this.name)) { ModuleMaker.AssetPath = "Unnamed Assets"; EditorGUILayout.HelpBox("Please enter a name.", MessageType.Error); } else { ModuleMaker.AssetPath = this.name + " Assets"; } this.installSDK = EditorGUILayout.Toggle("Install Stereo SDK", this.installSDK); this.exclusiveFullScreen = EditorGUILayout.Toggle("Exclusive Full Screen", this.exclusiveFullScreen); }
public override void Build(ModuleMaker maker, GameObject root, GameObject head) { ModuleMaker.AssetPath = AssetDatabase.GUIDToAssetPath(AssetDatabase.CreateFolder("Assets", ModuleMaker.AssetPath)); root.name = "Virtual Environment"; head.name = "Head"; head.AddComponent <AudioListener>(); }
public override void OnGUI(ModuleMaker maker) { WindowDesignUtility.DrawTexture(this.logo); EditorGUILayout.LabelField("Welcome to the CAVE Automated Virtual Enviroment Setup.", EditorStyles.boldLabel); EditorGUILayout.LabelField( "The next steps allow you to configure your own virtual enviroment. " + "Some functionalities are optional and you can choose if the environment should support them.", EditorStyles.wordWrappedLabel); }
public override void Build(ModuleMaker maker, GameObject root, GameObject head) { if (this.trackableHead) { head.AddComponent <KinectTrackableHead>(); } if (this.trackableHands) { GameObject leftHand = GameObject.CreatePrimitive(PrimitiveType.Sphere); leftHand.name = "Left Hand"; leftHand.transform.parent = root.transform; leftHand.transform.SetSiblingIndex(1); leftHand.transform.localPosition = new Vector3(-0.3f, 1f, 0f); leftHand.GetComponent <SphereCollider>().radius = 0.1f; leftHand.AddComponent <KinectTrackableHand>().HandType = HandType.Left; MonoBehaviour.DestroyImmediate(leftHand.GetComponent <MeshRenderer>()); GameObject rightHand = GameObject.CreatePrimitive(PrimitiveType.Sphere); rightHand.name = "Right Hand"; rightHand.transform.parent = root.transform; rightHand.transform.SetSiblingIndex(2); rightHand.transform.localPosition = new Vector3(0.3f, 1f, 0f); rightHand.GetComponent <SphereCollider>().radius = 0.1f; rightHand.AddComponent <KinectTrackableHand>().HandType = HandType.Right; MonoBehaviour.DestroyImmediate(rightHand.GetComponent <MeshRenderer>()); } GameObject kinect = new GameObject("Kinect Play Area"); kinect.transform.parent = root.transform; kinect.transform.localPosition = Vector3.zero; KinectPlayArea playArea = kinect.AddComponent <KinectPlayArea>(); string assetPath = ModuleMaker.AssetPath + "/Kinect Settings.asset"; KinectSettings asset = AssetDatabase.LoadAssetAtPath <KinectSettings>(assetPath); if (asset == null) { asset = ScriptableObject.CreateInstance <KinectSettings>(); asset.SensorLocation = this.sensorLocation; asset.TrackingArea = new Rect(0f, 0f, this.trackingAreaWidth, this.trackingAreaLength); AssetDatabase.CreateAsset(asset, assetPath); } playArea.Settings = asset; }
public override void OnGUI(ModuleMaker maker) { WindowDesignUtility.SectionLabel("Physical Controls"); bool joycon = maker.IsModuleAvailable <JoyconModule>(); using (new EditorGUI.DisabledScope(!joycon)) { this.firstPerson = EditorGUILayout.Toggle("First Person", this.firstPerson); if (!joycon) { EditorGUILayout.HelpBox("Nintendo Joy-Con support required.", MessageType.Warning); } } bool kinect = maker.IsModuleAvailable <KinectModule>(); using (new EditorGUI.DisabledScope(!joycon || !kinect)) { this.teleporter = EditorGUILayout.Toggle("Teleporter", this.teleporter); if (!joycon || !kinect) { EditorGUILayout.HelpBox("Nintendo Joy-Con and Microsoft Kinect 2.0 support required.", MessageType.Warning); } } EditorGUILayout.Separator(); using (new EditorGUI.DisabledScope(this.firstPerson || this.teleporter)) { WindowDesignUtility.SectionLabel("Non-Physical Controls"); this.freeLook = EditorGUILayout.Toggle("Free Look", this.freeLook); if (!joycon) { EditorGUILayout.HelpBox("Nintendo Joy-Con support required.", MessageType.Warning); } } }
public override void Build(ModuleMaker maker, GameObject root, GameObject head) { GameObject joycon = new GameObject("Joycon Controller"); joycon.transform.parent = root.transform; joycon.transform.localPosition = Vector3.zero; JoyconController controller = joycon.AddComponent <JoyconController>(); string assetPath = ModuleMaker.AssetPath + "/Joycon Binding.asset"; JoyconBinding asset = AssetDatabase.LoadAssetAtPath <JoyconBinding>(assetPath); if (asset == null) { asset = ScriptableObject.CreateInstance <JoyconBinding>(); AssetDatabase.CreateAsset(asset, assetPath); } controller.Binding = asset; JoyconBindingEditor.CreateDefaultInputManagerEntries(); }
public override void Build(ModuleMaker maker, GameObject root, GameObject head) { if (maker.IsModuleAvailable <JoyconModule>()) { if (this.firstPerson) { TryAttachHeightControlledCollider(root, head); AttachFirstPerson(root); } if (this.teleporter && maker.IsModuleAvailable <KinectModule>()) { TryAttachHeightControlledCollider(root, head); AttachTeleporter(root); } bool physicals = this.firstPerson || this.teleporter; if (!physicals && this.freeLook) { AttachFreeLook(root); } } }
public override void OnGUI(ModuleMaker maker) { }
public override void Build(ModuleMaker maker, GameObject root, GameObject head) { ProjectorBrain brain = root.AddComponent <ProjectorBrain>(); brain.transform.position = this.position; ProjectorEyes eyes = head.AddComponent <ProjectorEyes>(); eyes.transform.parent = brain.transform; eyes.transform.localPosition = new Vector3(0f, 1.8f, 0f); ProjectorMount mount = (new GameObject("Mount")).AddComponent <ProjectorMount>(); mount.transform.parent = brain.transform; mount.transform.localPosition = eyes.transform.localPosition; mount.Eyes = eyes; if (this.selection.HasFlag(ProjectorSelection.Front)) { ProjectorPlane plane = CreatePlane(brain, new Vector3(0, this.height * 0.5f, this.length * 0.5f), Vector3.zero); ProjectorCamera camera = CreateCamera(mount, plane); CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Front), this.width, this.height); } if (this.selection.HasFlag(ProjectorSelection.Back)) { ProjectorPlane plane = CreatePlane(brain, new Vector3(0, this.height * 0.5f, -this.length * 0.5f), Vector3.up * 180f); ProjectorCamera camera = CreateCamera(mount, plane); CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Back), this.width, this.height); } if (this.selection.HasFlag(ProjectorSelection.Top)) { ProjectorPlane plane = CreatePlane(brain, new Vector3(0, this.height, 0), Vector3.right * -90f); ProjectorCamera camera = CreateCamera(mount, plane); CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Top), this.width, this.length); } if (this.selection.HasFlag(ProjectorSelection.Bottom)) { ProjectorPlane plane = CreatePlane(brain, Vector3.zero, Vector3.right * 90f); ProjectorCamera camera = CreateCamera(mount, plane); CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Bottom), this.width, this.length); } if (this.selection.HasFlag(ProjectorSelection.Left)) { ProjectorPlane plane = CreatePlane(brain, new Vector3(-this.width * 0.5f, this.height * 0.5f, 0), Vector3.up * -90f); ProjectorCamera camera = CreateCamera(mount, plane); CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Left), this.length, this.height); } if (this.selection.HasFlag(ProjectorSelection.Right)) { ProjectorPlane plane = CreatePlane(brain, new Vector3(this.width * 0.5f, this.height * 0.5f, 0), Vector3.up * 90f); ProjectorCamera camera = CreateCamera(mount, plane); CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Right), this.length, this.height); } string assetPath = ModuleMaker.AssetPath + "/Projector Settings.asset"; ProjectorSettings asset = AssetDatabase.LoadAssetAtPath <ProjectorSettings>(assetPath); if (asset == null) { asset = ScriptableObject.CreateInstance <ProjectorSettings>(); asset.CameraTarget = this.target; asset.ForceFullScreen = false; asset.StereoSeparation = 0.064f; asset.StereoConvergence = 10f; asset.NearClipPlane = 0.01f; asset.FarClipPlane = 1000f; AssetDatabase.CreateAsset(asset, assetPath); } brain.Settings = asset; }
public override void OnGUI(ModuleMaker maker) { WindowDesignUtility.SectionLabel("Bindings"); this.dpadBindings = EditorGUILayout.Toggle("Dpad", this.dpadBindings); }