private void CLIMBING_IN_The_VU() { //Vector3 vCtrl1_to_Ctrl2 = ctrl2.transform.position - ctrl1.transform.position; bool bClimb1 = ctrl1.GetComponent<Argos_Controller_Interface>().bClimbing; bool bClimb2 = ctrl2.GetComponent<Argos_Controller_Interface>().bClimbing; Vector3 axis; float angle; if (bClimb1 || bClimb2) { if (is_A_Trigger_Pressed() && bClimb1) { //print("Climb Frame Trigger & bClimb - 1"); vCtrl1_Right = ctrl1.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl1_Right, vCtrl1_Last_Right); vCtrl1_Up = ctrl1.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl1_Up, vCtrl1_Last_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_1 = Vector3.Slerp(slerp_Ctrl_Pos_1, ctrl1.transform.position, Time.deltaTime * grab_Rotate_Damping); slerp_Rotation_1 = Quaternion.Slerp(slerp_Rotation_1, q3, Time.deltaTime * grab_Rotate_Damping); slerp_Rotation_1.ToAngleAxis(out angle, out axis); argos_Teleport.transform.RotateAround(ctrl1.transform.position, axis, angle * 0.99f); //VU_UI.transform.RotateAround(ctrl1.transform.position, axis, angle * 0.99f); } else if (is_A_Trigger_Pressed() && bClimb2) { //print("Climb Frame Trigger & bClimb - 2"); vCtrl2_Right = ctrl2.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl2_Right, vCtrl2_Last_Right); vCtrl2_Up = ctrl2.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl2_Up, vCtrl2_Last_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_2 = Vector3.Slerp(slerp_Ctrl_Pos_2, ctrl2.transform.position, Time.deltaTime * grab_Rotate_Damping); slerp_Rotation_2 = Quaternion.Slerp(slerp_Rotation_2, q3, Time.deltaTime * grab_Rotate_Damping); slerp_Rotation_2.ToAngleAxis(out angle, out axis); argos_Teleport.transform.RotateAround(ctrl2.transform.position, axis, angle * 0.99f); //VU_UI.transform.RotateAround(ctrl2.transform.position, axis, angle * 0.99f); } if (!is_A_Trigger_Pressed()) { float c = 1; if (current_USER_LOCATION == USER_LOCATION.IN_THE_VU) { c = curr_Flight_Velocity; } if (bClimb1) { //print("Climb Frame GRIP & bClimb - 1"); Vector3 vDelt = ctrl1.transform.position - vCtrl1_Last_Pos; Vector3 vTran = c * vDelt; //argos_Teleport.transform.InverseTransformDirection(c * vDelt); argos_Teleport.transform.position -= vTran; //VU_UI.transform.position -= vTran; } else if (bClimb2) { //print("Climb Frame GRIP & bClimb - 2"); Vector3 vDelt = ctrl2.transform.position - vCtrl2_Last_Pos; Vector3 vTran = c * vDelt; //argos_Teleport.transform.InverseTransformDirection(c *vDelt); argos_Teleport.transform.position -= vTran; //VU_UI.transform.position -= vTran; } if (active_Ctrl_States.bCtrl_1_On) { //slerp_Ctrl_Pos_1 = ctrl1.transform.position; //slerp_Rotation_1 = Quaternion.identity; vCtrl1_Right = ctrl1.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl1_Right, vCtrl1_Right); vCtrl1_Up = ctrl1.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl1_Up, vCtrl1_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_1 = ctrl1.transform.position; slerp_Rotation_1 = q3; } if (active_Ctrl_States.bCtrl_2_On) { //slerp_Ctrl_Pos_2 = ctrl2.transform.position; //slerp_Rotation_2 = Quaternion.identity; vCtrl2_Right = ctrl2.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl2_Right, vCtrl2_Right); vCtrl2_Up = ctrl2.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl2_Up, vCtrl2_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_2 = ctrl2.transform.position; slerp_Rotation_2 = q3; } } } else { if (active_Ctrl_States.bCtrl_1_On) { //slerp_Ctrl_Pos_1 = ctrl1.transform.position; //slerp_Rotation_1 = Quaternion.identity; vCtrl1_Right = ctrl1.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl1_Right, vCtrl1_Right); vCtrl1_Up = ctrl1.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl1_Up, vCtrl1_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_1 = ctrl1.transform.position; slerp_Rotation_1 = q3; } if (active_Ctrl_States.bCtrl_2_On) { //slerp_Ctrl_Pos_2 = ctrl2.transform.position; //slerp_Rotation_2 = Quaternion.identity; vCtrl2_Right = ctrl2.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl2_Right, vCtrl2_Right); vCtrl2_Up = ctrl2.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl2_Up, vCtrl2_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_2 = ctrl1.transform.position; slerp_Rotation_2 = q3; } } vCtrl1_Last_Right = ctrl1.transform.right; vCtrl2_Last_Right = ctrl2.transform.right; vCtrl1_Last_Up = ctrl1.transform.up; vCtrl2_Last_Up = ctrl2.transform.up; vCtrl1_Last_Pos = ctrl1.transform.position; vCtrl2_Last_Pos = ctrl2.transform.position; }
using UnityEngine; using System.Collections; using UnityEngine.UI; using Valve.VR; using VRTK; using System.Collections.Generic; using ProceduralToolkit; using System; using System.IO; using VRStandardAssets.Menu; using VRStandardAssets.Utils; public class HMD_Ctrl_Tracking : MonoBehaviour { public bool bFREE_VERSION = false; public enum USER_LOCATION { LOBBY, LAB, IN_THE_VU, PROTOTYPING, } public GameObject[] planets; public Solar_System_Base solar_System_Base; public GameObject planet_Teleporter_Prefab; public GameObject solar_System_HANDLE; public GameObject[] ptp_GOs; public Button_VU bv_Show_Attractors; public Planet_Ride planet_Ride; public float fTeleport_Attractor_Dist = 0.1f; public enum USE_MODE { DYNAMIC, STYLUS, VACUUM, EU_2017, } //public enum FLIGHT_MODE //{ // VIOLET, // BLUE, // GREEN, // ORANGE, // RED, //} public USER_LOCATION start_USER_LOCATION = USER_LOCATION.LOBBY; private USER_LOCATION current_USER_LOCATION; private Vector3 vAverage_Dist_Head_to_Floor_LAB; public GameObject start_Lobby_LOOK_AT_GO; public GameObject start_Lobby_HEAD_POSITION; //public GameObject start_Lobby_UI_MARKER; public GameObject start_Lab_LOOK_AT_GO; public GameObject start_Lab_HEAD_POSITION; public Slider scale_MERC_Slider; public float damp_Lobby_cam = 0.3f; public SteamVR_TrackedObject hmdTrackedObject; public GameObject go_Internal_UI; public GameObject go_VU_UI; public Vu_Spawn_Control vu_Spawn_Control; public Vu_Time_Assembly vu_Time_Assembly; public USE_MODE use_MODE = USE_MODE.DYNAMIC; private USE_MODE use_MODE_Last = USE_MODE.DYNAMIC; public VRCameraFade vrFade_In; [Serializable] public class Active_Ctrl_States // { public bool bCtrl_1_On = false; public bool bCtrl_2_On = false; public bool bStylus_1_Extended = false; public bool bStylus_2_Extended = false; public bool bStylus_1_Editing = false; public bool bStylus_2_Editing = false; public bool bFineTune_1_On = false; public bool bFineTune_2_On = false; public bool bMINIATURE_Mode_On = false; public float world_Scale = 1; public bool bFlight_1_On = false; public bool bFlight_2_On = false; public bool bGlobal_Flight_Control_On = false; public int curr_FLIGHT_MODE = 0; public bool bTrigger_1_Pressed = false; public bool bTrigger_2_Pressed = false; public bool bTouchpad_1_Pressed = false; public bool bTouchpad_2_Pressed = false; public bool bTouchpad_1_Touched = false; public bool bTouchpad_2_Touched = false; public bool bLinear_1_On = false; public bool bLinear_2_On = false; public bool bTool_Tips_On = false; public bool bTHE_VU_is_RUNNING = false; } public bool bBoth_Ctrl_On = false; private Glass_Stabilizer glass_Stabilizer; public bool bUI_Grabbed_Glass_Hold = false; private Argos_Controller_Interface argos_Controller_Interface_1; private Argos_Controller_Interface argos_Controller_Interface_2; public Controller_State_Indicator controller_State_Indicator; public Controller_Rotations ctrl_1_Rotations; public Controller_Rotations ctrl_2_Rotations; private Controller_Rotations ctrl_Rotation;//swapper public Active_Ctrl_States active_Ctrl_States; //SINGLETON public static HMD_Ctrl_Tracking Instance = null; public Argos_Teleport argos_Teleport; public Button_VU bv_Lab_Indicate; public Button_VU bv_Phi_In_The_VU_Indicate; public Button_VU bv_Lobby_Indicate; public GameObject gridSpace; public GameObject emitter_Source; public GameObject collector_Source; private Vector3 collector_Saved_Velocity; private Vector3 collector_Saved_Angular_Velocity; public GameObject centerSphere; public GameObject emitter_Handle; //public GameObject collector_Handle; //public GameObject teleporter_Button; public float attractors_Relative_Scale = 1; public float emit_collect_Relative_Scale = 0.5f; public float attractor_start_radius = 15; public GameObject attractor_point; public GameObject attractor_Selector; private GameObject attractor_Selector_Inst; public GameObject newFrisbee; public GameObject monad_Ball; public GameObject diad_Ball; public GameObject triad_Ball; public GameObject tetra_Ball; public GameObject octa_Ball; public GameObject hexa_Ball; public GameObject merk_Ball; public GameObject cubeOct_Ball; public GameObject icosa_Ball; public GameObject dodec_Ball; public GameObject five_2D_Ball; public GameObject seven_2D_Ball; public Platonic_Selector_Injector.type current_Platonic_Selected = Platonic_Selector_Injector.type.MONAD; public GameObject pendulum_Ball; public GameObject frisbee_Ball; public GameObject ctrl1; public GameObject ctrl2; public GameObject ctrl1_Tracked_Base; public GameObject ctrl2_Tracked_Base; private GameObject most_Recent_Interacting_Controller; public GameObject collector_BaseGO; private Vector3 vDelt_ctrl1_to_ctrl2_last; private Vector3 vCtrl1_Last_Pos; private Vector3 vCtrl2_Last_Pos; private Vector3 vCtrl1_Right; private Vector3 vCtrl1_Last_Right; private Vector3 vCtrl1_Up; private Vector3 vCtrl1_Last_Up; private Vector3 vCtrl2_Right; private Vector3 vCtrl2_Last_Right; private Vector3 vCtrl2_Up; private Vector3 vCtrl2_Last_Up; public class Att_Params { public Vector3 vAxis; public float strength; public float radial_amount; public int linear_ON; public float linear_amount; public int rotational_ON; public float rotational_amount; public int toroidal_ON; public float toroidal_amount; public int birkeland_ON; public int rings_ON; public float split_dist; public float inner_Radius; public float outer_Radius; public Vector3 savedVelocity; public Vector3 savedAngularVelocity; public int currentOrientation; // 1 of 27 public Att_Params() { vAxis = Vector3.up; strength = 1f; radial_amount = 1f; linear_ON = 0; linear_amount = 0f; rotational_ON = 0; rotational_amount = 0f; toroidal_ON = 0; toroidal_amount = 0f; birkeland_ON = 0; rings_ON = 0; split_dist = 1.5f; inner_Radius = 12f; outer_Radius = 144f; savedVelocity = Vector3.zero; savedAngularVelocity = Vector3.zero; currentOrientation = 0; } } public Text Axis_Vector_Text; private GameObject[] att_GOs = new GameObject[20]; public Att_Params[] att_Params = new Att_Params[20]; public int nCurrent_Selected_Attractor = 0; public Text txt_Curr_Sel_Attractor; public bool bAdjust_All_Attractors = false; public Image adjust_All_Image; public List<Vector3> dodec_Verts = new List<Vector3>(); public List<Vector3> tetra_Verts = new List<Vector3>(); public List<Vector3> octa_Verts = new List<Vector3>(); public List<Vector3> hexa_Verts = new List<Vector3>(); public List<Vector3> merk_Verts = new List<Vector3>(); public List<Vector3> cubeOct_Verts = new List<Vector3>(); public List<Vector3> icosa_Verts = new List<Vector3>(); public List<Vector3> five_Verts = new List<Vector3>(); public List<Vector3> seven_Verts = new List<Vector3>(); public List<Vector3> triad_Verts = new List<Vector3>(); [Range(0.002f, 200f)] public float rQuadDist; [Range(0.002f, 4000f)] public float rCamDist; public Slider slideQuadDist; public Slider slideCamDist; public Slider slideUIDist; public float uiDist = 70f; private GameObject argosSphere; private Animator animator; private bool ui_On = false; public List<SerialVect3> equiDist_Base_SV3 = new List<SerialVect3>(); public List<Vector3> equiDist_Base_Vect3 = new List<Vector3>(); public Argos_Particle_Spawner argos_Particle_Spawner; public int nAttractorCount = 0; public MD_Scale_Cube md_Scale_Cube; public MD_Measure_Cube md_Measure_Cube; private bool bMeasure_Cube_On = false; private UI_Ladder ui_Ladder; private VU_UI_MANAGER VU_UI; public VU_UI_VISOR VU_UI_Visor; private Vector3 vu_UI_Base_Scale; private Serialize serialize; private Argos_File argos_file; public Button_VU stylus_Tog_BV; //ARGOS FLIGHT CONTROL - PATENT PENDING CANDIDATE public Quaternion qRadial_Upper_Read_Flight_Ctrl_1; public Quaternion qRadial_Base_Flight_Ctrl_1; public Quaternion qRadial_Upper_Read_Flight_Ctrl_2; public Quaternion qRadial_Base_Flight_Ctrl_2; public Vector3 vPOS_Upper_Read_Flight_Ctrl_1; public Vector3 vPOS_Base_Flight_Ctrl_1; public Vector3 vPOS_Upper_Read_Flight_Ctrl_2; public Vector3 vPOS_Base_Flight_Ctrl_2; private bool bForceGrabOn; private GameObject grabingCtrl; public GameObject pendulum_Handle; //Handle public GameObject pendulum_Bob; public GameObject Frisbee; public delegate void USE_MODE_Event_Handler(USE_MODE useMode); public event USE_MODE_Event_Handler Use_Mode_Change; float small_val = 1.0E-12f; //public delegate void onBoth_ControllersOn_Event_Handler(); //public event onBoth_ControllersOn_Event_Handler OnBothCtrl_On; //public delegate void onBoth_Controllers_NOT_On_Event_Handler(); //public event onBoth_Controllers_NOT_On_Event_Handler OnBothCtrl_NOT_On; public MenuSelectorMover menuSelectorMover;//LOBBY StreamWriter sWrite; public Vector3[] vOrientation = new Vector3[27]; public float curr_Flight_Rotation_Rate; public float curr_Flight_Velocity; void Awake() { if (Instance == null) Instance = this; else if (Instance != this) Destroy(gameObject); DontDestroyOnLoad(gameObject);//HERE IS THE DON'T DESTROY ON LOAD //sWrite = new StreamWriter("GESTURE_TEST.txt"); build_Geometry_Lists(); init_Attractor_Selector(); Init_Orients(); } private void Init_Orients() { vOrientation[0] = new Vector3(0, 0, 0); vOrientation[1] = new Vector3(0, 0, -45); vOrientation[2] = new Vector3(0, -45, -45); vOrientation[3] = new Vector3(0, -90, -45); vOrientation[4] = new Vector3(0, -135, -45); vOrientation[5] = new Vector3(0, -180, -45); vOrientation[6] = new Vector3(0, -225, -45); vOrientation[7] = new Vector3(0, -270, -45); vOrientation[8] = new Vector3(0, -315, -45); vOrientation[9] = new Vector3(0, 0, -90); vOrientation[10] = new Vector3(0, -45, -90); vOrientation[11] = new Vector3(0, -90, -90); vOrientation[12] = new Vector3(0, -135, -90); vOrientation[13] = new Vector3(0, -180, -90); vOrientation[14] = new Vector3(0, -225, -90); vOrientation[15] = new Vector3(0, -270, -90); vOrientation[16] = new Vector3(0, -315, -90); vOrientation[17] = new Vector3(0, 0, -135); vOrientation[18] = new Vector3(0, -45, -135); vOrientation[19] = new Vector3(0, -90, -135); vOrientation[20] = new Vector3(0, -135, -135); vOrientation[21] = new Vector3(0, -180, -135); vOrientation[22] = new Vector3(0, -225, -135); vOrientation[23] = new Vector3(0, -270, -135); vOrientation[24] = new Vector3(0, -315, -135); vOrientation[25] = new Vector3(0, 0, -180); } private void Start() { ARGOS_TRACE.Instance.Mark("******* HMD _ START ***********"); ui_Ladder = UI_Ladder.Instance; VU_UI = VU_UI_MANAGER.Instance; vu_UI_Base_Scale = Vector3.one; serialize = Serialize.Instance; argos_file = Argos_File.Instance; ui_Ladder = UI_Ladder.Instance; Enable_HMD_Ctrl_1(); Enable_HMD_Ctrl_2(); most_Recent_Interacting_Controller = null; ARGOS_TRACE.Instance.Mark("Init_THE_VU(2)"); Init_THE_VU(2); } public void Init_THE_VU(float waitTime) { //ARGOS_TRACE.Instance.Mark("solar_System_Base.Init_Solar_System()"); if (!Application.isEditor) { solar_System_Base.Initial_Init_Solar_System();//EU 2017 } //ARGOS_TRACE.Instance.Mark("StartCoroutine(CoRoutine_Init_THE_VU(2)"); StartCoroutine(CoRoutine_Init_THE_VU(waitTime)); } IEnumerator CoRoutine_Init_THE_VU(float waitTime) { ARGOS_TRACE.Instance.Mark("CoRoutine_Init_THE_VU"); Set_USER_Location(HMD_Ctrl_Tracking.USER_LOCATION.LOBBY); //argos_Teleport.Set_Head_UpRight_Start(); Pops frames at beginning yield return new WaitForSeconds(waitTime / 2); Set_Internal_UI_Active(true); VU_UI.Activate_All_Panels(); ui_Ladder.Init_UI_Ladder(); Set_Internal_UI_Scale_To_Minimized(); VU_UI.Get_VU_Panel_Interface().Select_Start_Panel(); serialize.Load_ARG_FILE_On_HMD_Ctrl_Startup(); yield return new WaitForSeconds(waitTime / 4); Argos_Sound_Manager.Instance.Set_Sounds_Active(true); VU_UI_Visor.Set_UI_at_Start_Position(); //serialize.LoadPreset_toEditor(0, false); //ARGOS_TRACE.Instance.Mark("serialize.Post_Load_Settup();"); //serialize.Post_Load_Settup(); //ARGOS_TRACE.Instance.Mark("serialize.LoadPreset_toEditor(11, false)"); //serialize.LoadPreset_toEditor(0, false); //Teleport_To_Start_State(); //ui_Ladder.set_App_Mode(UI_Ladder.App_Mode.PLATONICS); SetFlight_Rates(); active_Ctrl_States.bTHE_VU_is_RUNNING = true; vrFade_In.FadeIn(1.2f, true); yield return new WaitForSeconds(waitTime / 4); } //public void SetUI_At_Start_Position() //{ // //VU_UI.gameObject.transform.position = start_Lobby_UI_MARKER.transform.position; // //VU_UI.gameObject.transform.rotation = start_Lobby_UI_MARKER.transform.rotation; // //VU_UI.gameObject.transform.parent = start_Lobby_UI_MARKER.transform; // //VU_UI.gameObject.transform.localScale = Vector3.one; // //VU_UI.GetComponent<Animator>().enabled = true; //} public void Teleport_To_Start_State() { StartCoroutine(deferTeleport_To_Start_State()); } IEnumerator deferTeleport_To_Start_State() { yield return new WaitForSeconds(0.07f); if (start_USER_LOCATION == USER_LOCATION.PROTOTYPING) { Indicate_Location(USER_LOCATION.LAB); argos_Teleport.gArgos_Lobby.SetActive(false); } else if (start_USER_LOCATION == USER_LOCATION.LAB) { Indicate_Location(USER_LOCATION.LAB); argos_Teleport.Start_In_Lab(); VU_UI.gameObject.transform.localScale = VU_UI.base_Scale / UI_Ladder.Instance.Zoom_Scale; //StartCoroutine(defer_Introduce_UI()); } else if (start_USER_LOCATION == USER_LOCATION.LOBBY) { Indicate_Location(USER_LOCATION.LOBBY); //Teleport_to_LOBBY(); //StartCoroutine(defer_Introduce_UI()); } else if (start_USER_LOCATION == USER_LOCATION.IN_THE_VU) { Indicate_Location(USER_LOCATION.IN_THE_VU); Teleport_to_Attractor_0();//UPDATE TO GIVEN LOCATION argos_Teleport.gArgos_Lobby.SetActive(false); } } //IEnumerator defer_Introduce_UI() //{ // yield return new WaitForSeconds(1.61803f); // VU_UI.Present_VU_UI(); //} public void init_Attractor_Selector() { attractor_Selector_Inst = Instantiate(attractor_Selector); nCurrent_Selected_Attractor = 0; attractor_Selector_Inst.transform.parent = att_GOs[nCurrent_Selected_Attractor].transform; attractor_Selector_Inst.transform.localPosition = Vector3.zero; attractor_Selector_Inst.transform.localScale = att_GOs[nCurrent_Selected_Attractor].transform.localScale; attractor_Selector_Inst.transform.localRotation = Quaternion.identity; } public Argos_Teleport getPlayArea() { return argos_Teleport; } public void TakeScreenShot() { serialize.onCaptcha(); } public void Set_Internal_UI_Active(bool bOn) { go_Internal_UI.SetActive(bOn); } public void Set_Internal_UI_Scale_To_Minimized() { go_Internal_UI.transform.localScale = Vector3.one * 0.0000001f; } public void Set_VU_UI_Active(bool bOn) { go_VU_UI.SetActive(bOn); } public void Parent_Attactors_To_Collector(bool bParent) { if (bParent) { for (int i = 0; i < 20; i++) { att_GOs[i].transform.parent = collector_Source.transform; } } else { for (int i = 0; i < 20; i++) { att_GOs[i].transform.parent = null; } } } public void On_Pause_Button_VU(bool bOn) { if (bOn) { Rigidbody rb; for (int i = 0; i < 20; i++) { rb = att_GOs[i].GetComponent<Rigidbody>(); att_Params[i].savedVelocity = rb.velocity; att_Params[i].savedAngularVelocity = rb.angularVelocity; rb.isKinematic = true; } rb = collector_Source.GetComponent<Rigidbody>(); collector_Saved_Velocity = rb.velocity; collector_Saved_Angular_Velocity = rb.angularVelocity; rb.isKinematic = true; collector_Source.GetComponent<Collector_Rotation>().Set_Paused(true); vu_Time_Assembly.ringModulator.Set_Paused(true); } else//Resume { Rigidbody rb; for (int i = 0; i < 20; i++) { rb = att_GOs[i].GetComponent<Rigidbody>(); if (att_Params[i].savedVelocity != Vector3.zero || att_Params[i].savedAngularVelocity != Vector3.zero) { rb.isKinematic = false; rb.AddForce(att_Params[i].savedVelocity, ForceMode.VelocityChange); rb.AddTorque(att_Params[i].savedAngularVelocity, ForceMode.VelocityChange); } } rb = collector_Source.GetComponent<Rigidbody>(); rb.isKinematic = false; rb.AddForce(collector_Saved_Velocity, ForceMode.VelocityChange); rb.AddTorque(collector_Saved_Angular_Velocity, ForceMode.VelocityChange); collector_Source.GetComponent<Collector_Rotation>().Set_Paused(false); vu_Time_Assembly.ringModulator.Set_Paused(false); } } public void Reset_Accessories_to_Original_Local_Positions() { pendulum_Handle.GetComponent<Return_to_Spawn>().ResetToSpawn(); pendulum_Bob.GetComponent<Return_to_Spawn>().ResetToSpawn(); Frisbee.GetComponent<Return_to_Spawn>().ResetToSpawn(); monad_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); diad_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); triad_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); tetra_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); octa_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); hexa_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); merk_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); cubeOct_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); icosa_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); dodec_Ball.GetComponent<Return_to_Spawn>().ResetToSpawn(); } public MD_Measure_Cube Get_MD_Measure_Cube() { return md_Measure_Cube; } public void Set_Measure_Cube(bool bOn) { bMeasure_Cube_On = bOn; if (bOn)//Stop all motion of Attractors { Rigidbody rb; rb = collector_Source.GetComponent<Rigidbody>(); rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; foreach (GameObject att in att_GOs) { rb = att.GetComponent<Rigidbody>(); rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; } } } public bool Measure_On() { return bMeasure_Cube_On; } public GameObject Get_Pendulum_Handle() { return pendulum_Handle; } public GameObject Get_Pendulum_Bob() { return pendulum_Bob; } public GameObject Get_Frisbee() { return Frisbee; } public void Copy_Attractor_Params(Att_Params source, Att_Params dest) { dest.strength = source.strength; dest.radial_amount = source.radial_amount; dest.linear_amount = source.linear_amount; dest.rotational_amount = source.rotational_amount; dest.toroidal_amount = source.toroidal_amount; dest.split_dist = source.split_dist; dest.inner_Radius = source.inner_Radius; dest.outer_Radius = source.outer_Radius; dest.linear_ON = source.linear_ON; dest.rotational_ON = source.rotational_ON; dest.toroidal_ON = source.toroidal_ON; dest.birkeland_ON = source.birkeland_ON; } //public float strength; //public float radial_amount; //public int linear_ON; //public float linear_amount; //public int rotational_ON; //public float rotational_amount; //public int toroidal_ON; //public float toroidal_amount; //public int birkeland_ON; //public int rings_ON; //public float split_dist; //public float inner_Radius; //public float outer_Radius; //public Vector3 savedVelocity; //public Vector3 savedAngularVelocity; //public int currentOrientation; // 1 of 27 public GameObject get_Attractor(int i) { return att_GOs[i]; } public void Attractor_Write_Selected_to_All() { for (int i = 0; i < nAttractorCount; i++) { Copy_Attractor_Params(att_Params[nCurrent_Selected_Attractor], att_Params[i]); att_GOs[i].GetComponent<Attractor_Show_Position>().set_Axis_Scale(att_Params[i].linear_amount); att_GOs[i].GetComponent<Attractor_Show_Position>().set_TorRaDial_Scale(att_Params[i].rotational_amount); att_GOs[i].GetComponent<Attractor_Show_Position>().set_Strength_Sphere_Compass_Scale(att_Params[i].strength); att_GOs[i].GetComponent<Attractor_Show_Position>().SetRings_Radii(att_Params[i].inner_Radius, att_Params[i].outer_Radius); } } public void onPointer_Down_Adjust_All() { bAdjust_All_Attractors = !bAdjust_All_Attractors; } public void Select_Attractor_for_Edit(int i) { nCurrent_Selected_Attractor = i; if (nCurrent_Selected_Attractor >= nAttractorCount) { nCurrent_Selected_Attractor = 0; } attractor_Selector_Inst.transform.parent = att_GOs[nCurrent_Selected_Attractor].transform; attractor_Selector_Inst.transform.localPosition = Vector3.zero; attractor_Selector_Inst.transform.localRotation = Quaternion.identity; txt_Curr_Sel_Attractor.text = nCurrent_Selected_Attractor.ToString(); Set_UI_Attractor_for_Edit(nCurrent_Selected_Attractor); VU_UI.GetComponent<VU_UI_Panel_Interface>().Update_current_Panel_Sliders(); } public void Select_Next_Attractor() { if (++nCurrent_Selected_Attractor >= nAttractorCount) { nCurrent_Selected_Attractor = 0; } attractor_Selector_Inst.transform.parent = att_GOs[nCurrent_Selected_Attractor].transform; attractor_Selector_Inst.transform.localPosition = Vector3.zero; attractor_Selector_Inst.transform.localRotation = Quaternion.identity; txt_Curr_Sel_Attractor.text = nCurrent_Selected_Attractor.ToString(); Set_UI_Attractor_for_Edit(nCurrent_Selected_Attractor); VU_UI.GetComponent<VU_UI_Panel_Interface>().Update_current_Panel_Sliders(); } public void Select_Previous_Attractor() { if (--nCurrent_Selected_Attractor < 0) { nCurrent_Selected_Attractor = nAttractorCount - 1; } attractor_Selector_Inst.transform.parent = att_GOs[nCurrent_Selected_Attractor].transform; attractor_Selector_Inst.transform.localPosition = Vector3.zero; attractor_Selector_Inst.transform.localRotation = Quaternion.identity; txt_Curr_Sel_Attractor.text = nCurrent_Selected_Attractor.ToString(); Set_UI_Attractor_for_Edit(nCurrent_Selected_Attractor); VU_UI.GetComponent<VU_UI_Panel_Interface>().Update_current_Panel_Sliders(); } public void Set_Attractor_Linear_On(bool bEnabled) { att_Params[nCurrent_Selected_Attractor].linear_ON = bEnabled ? 1 : 0; if (bAdjust_All_Attractors) { for (int i = 0; i < 20; i++) { att_Params[i].linear_ON = bEnabled ? 1 : 0; } } } public void Set_Attractor_Rota_On(bool bEnabled) { att_Params[nCurrent_Selected_Attractor].rotational_ON = bEnabled ? 1 : 0; if (bAdjust_All_Attractors) { for (int i = 0; i < 20; i++) { att_Params[i].rotational_ON = bEnabled ? 1 : 0; } } } public void Set_Attractor_Toro_On(bool bEnabled) { att_Params[nCurrent_Selected_Attractor].toroidal_ON = bEnabled ? 1 : 0; if (bAdjust_All_Attractors) { for (int i = 0; i < 20; i++) { att_Params[i].toroidal_ON = bEnabled ? 1 : 0; } } } public void Set_Attractor_Birkeland_On(bool bEnabled) { att_Params[nCurrent_Selected_Attractor].birkeland_ON = bEnabled ? 1 : 0; ui_Ladder.birkeland_TOG_BV.isON = bEnabled; if (bAdjust_All_Attractors) { for (int i = 0; i < 20; i++) { att_Params[i].birkeland_ON = bEnabled ? 1 : 0; } } } public bool Set_UI_Attractor_for_Edit(int idx) { if (idx < nAttractorCount) { ui_Ladder.attractor_Strength_Slider.value = att_Params[idx].strength;//1.0f;// ui_Ladder.attractor_Radial_Amount_Slider.value = att_Params[idx].radial_amount; ui_Ladder.attractor_Linear_Amount_Slider.value = att_Params[idx].linear_amount; ui_Ladder.attractor_rotational_amount_Slider.value = att_Params[idx].rotational_amount; ui_Ladder.attractor_toroidal_amount_Slider.value = att_Params[idx].toroidal_amount; ui_Ladder.attractor_Split_Perp_Dist_Slider.value = att_Params[idx].split_dist;//1.5f;// ui_Ladder.attractor_Inner_Radius_Slider.value = att_Params[idx].inner_Radius; ui_Ladder.attractor_Outer_Radius_Slider.value = att_Params[idx].outer_Radius; ui_Ladder.attractor_Linear_Amount_BV.isON = (att_Params[idx].linear_ON == 0) ? false : true; ui_Ladder.attractor_Rota_Amount_BV.isON = (att_Params[idx].rotational_ON == 0) ? false : true; ui_Ladder.attractor_Toro_Amount_BV.isON = (att_Params[idx].toroidal_ON == 0) ? false : true; ui_Ladder.birkeland_TOG_BV.isON = (att_Params[idx].birkeland_ON == 0) ? false : true; bool bRingsON = (att_Params[idx].rings_ON == 0) ? false : true; ui_Ladder.rings_TOG_BV.isON = bRingsON; Show_Radial_Rings(bRingsON); ui_Ladder.Set_Attractor_Slider_Enables_and_Disabled_Boxes_Internal(); VU_UI.GetComponent<VU_UI_Panel_Interface>().Update_current_Panel_Sliders(); return true; } return false; } public int Get_Current_Mode_Attractor_Count() { if (ui_Ladder.app_Mode == UI_Ladder.App_Mode.TOYS && ui_Ladder.toys_DISPENSOR.current_Mode == TOYs_Pendulum_Frisbee.MODE.FRISBEE) { return 2; } else if (ui_Ladder.app_Mode == UI_Ladder.App_Mode.TOYS && ui_Ladder.toys_DISPENSOR.current_Mode == TOYs_Pendulum_Frisbee.MODE.FRISBEE) { return 1; } else if (ui_Ladder.app_Mode == UI_Ladder.App_Mode.STYLUS) { return 0; } else return nCurrent_Selected_Attractor; } public void Turn_Off_All_Platonic_Attractors() { nAttractorCount = get_Attractor_Count(current_Platonic_Selected); int i; for (i = 0; i < 20; i++) { att_GOs[i].SetActive(false); } } public Platonic_Selector_Injector.type Get_Platonic_Type(int nCount) { if (nCount == 1) { return Platonic_Selector_Injector.type.MONAD; } else if (nCount == 2) { return Platonic_Selector_Injector.type.DIAD; } else if (nCount == 3) { return Platonic_Selector_Injector.type.TRIAD; } else if (nCount == 4) { return Platonic_Selector_Injector.type.TETRAHEDRON; } else if (nCount == 5) { return Platonic_Selector_Injector.type.FIVE_2D; } else if (nCount == 6) { return Platonic_Selector_Injector.type.OCTAHEDRON; } else if (nCount == 7) { return Platonic_Selector_Injector.type.SEVEN_2D; } else if (nCount == 8) { return Platonic_Selector_Injector.type.HEXAHEDRON; } else if (nCount == 12) { return Platonic_Selector_Injector.type.ICOSAHEDRON; } else if (nCount == 13) { return Platonic_Selector_Injector.type.CUBEOCTAHEDRON; } else if (nCount == 20) { return Platonic_Selector_Injector.type.DODECAHEDRON; } else return Platonic_Selector_Injector.type.MONAD; } public int get_Attractor_Count(Platonic_Selector_Injector.type psel_Type) { if (psel_Type == Platonic_Selector_Injector.type.MONAD) { return 1; } else if (psel_Type == Platonic_Selector_Injector.type.DIAD) { return 2; } else if (psel_Type == Platonic_Selector_Injector.type.TRIAD) { return 3; } else if (psel_Type == Platonic_Selector_Injector.type.TETRAHEDRON) { return 4; } else if (psel_Type == Platonic_Selector_Injector.type.FIVE_2D) { return 5; } else if (psel_Type == Platonic_Selector_Injector.type.OCTAHEDRON) { return 6; } else if (psel_Type == Platonic_Selector_Injector.type.SEVEN_2D) { return 7; } else if (psel_Type == Platonic_Selector_Injector.type.HEXAHEDRON) { return 8; } else if (psel_Type == Platonic_Selector_Injector.type.MERKABA) { return 8; } else if (psel_Type == Platonic_Selector_Injector.type.ICOSAHEDRON) { return 12; } else if (psel_Type == Platonic_Selector_Injector.type.CUBEOCTAHEDRON) { return 13; } else //if (psel_Type == Platonic_Selector_Injector.type.DODECAHEDRON) { return 20; } } public void Turn_On_Current_Platonic_Attractors() { nAttractorCount = get_Attractor_Count(current_Platonic_Selected); int i; for (i = 0; i < nAttractorCount; i++) { att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } argos_Particle_Spawner.SetAttractorCount(nAttractorCount); } public void Reset_Keep_Current_Attractor_Settings() { int idx = nCurrent_Selected_Attractor = 0; Select_Attractor_for_Edit(0); for (int i = 0; i < 20; i++) { att_GOs[i].GetComponent<Rigidbody>().isKinematic = true; att_GOs[i].GetComponent<Rigidbody>().velocity = Vector3.zero; att_GOs[i].GetComponent<Rigidbody>().angularVelocity = Vector3.zero; } } //public void Reset_Current_Attractor_From_Editor() //{ // int idx = nCurrent_Selected_Attractor; // ui_Ladder.attractor_Strength_Slider.value = att_Params[idx].strength = 1f; // ui_Ladder.attractor_Radial_Amount_Slider.value = att_Params[idx].radial_amount = 1f; // ui_Ladder.attractor_Linear_Amount_Slider.value = att_Params[idx].linear_amount = 0f; // ui_Ladder.attractor_rotational_amount_Slider.value = att_Params[idx].rotational_amount = 0f; // ui_Ladder.attractor_toroidal_amount_Slider.value = att_Params[idx].toroidal_amount = 0f; // ui_Ladder.attractor_Split_Perp_Dist_Slider.value = att_Params[idx].split_dist = 1.5f; // ui_Ladder.attractor_Inner_Radius_Slider.value = att_Params[idx].inner_Radius = 12f; // ui_Ladder.attractor_Outer_Radius_Slider.value = att_Params[idx].outer_Radius = 144f; // VU_UI.GetComponent<VU_UI_Panel_Interface>().Update_current_Panel_Sliders(); //} public void Reset_Current_Attractor_From_Editor() { int i = nCurrent_Selected_Attractor; att_GOs[i].transform.rotation = Quaternion.identity; att_Params[i].strength = 1f; att_GOs[i].GetComponent<Attractor_Show_Position>().set_Strength_Sphere_Compass_Scale(att_Params[i].strength); att_Params[i].radial_amount = 1f; att_Params[i].linear_amount = 0f; att_Params[i].linear_ON = 0; att_GOs[i].GetComponent<Attractor_Show_Position>().set_Axis_Scale(att_Params[i].linear_amount); att_Params[i].rotational_amount = 0f; att_Params[i].rotational_ON = 0; att_GOs[i].GetComponent<Attractor_Show_Position>().set_TorRaDial_Scale(att_Params[i].rotational_amount); att_Params[i].toroidal_amount = 0f; att_Params[i].toroidal_ON = 0; att_Params[i].split_dist = 1.5f; att_Params[i].inner_Radius = 5f; att_Params[i].outer_Radius = 7f; att_Params[i].rings_ON = 0; att_GOs[i].GetComponent<Attractor_Show_Position>().SetRings_Radii(att_Params[i].inner_Radius, att_Params[i].outer_Radius); att_GOs[i].GetComponent<Rigidbody>().isKinematic = true;//Turn off Physics ui_Ladder.attractor_Strength_Slider.value = att_Params[i].strength; ui_Ladder.attractor_Radial_Amount_Slider.value = att_Params[i].radial_amount; ui_Ladder.attractor_Linear_Amount_BV.isON = (att_Params[i].linear_ON == 0) ? false : true; ui_Ladder.attractor_Linear_Amount_Slider.value = att_Params[i].linear_amount; ui_Ladder.attractor_Rota_Amount_BV.isON = (att_Params[i].rotational_ON == 0) ? false : true; ui_Ladder.attractor_rotational_amount_Slider.value = att_Params[i].rotational_amount; ui_Ladder.attractor_Toro_Amount_BV.isON = (att_Params[i].toroidal_ON == 0) ? false : true; ui_Ladder.attractor_toroidal_amount_Slider.value = att_Params[i].toroidal_amount; ui_Ladder.birkeland_TOG_BV.isON = (att_Params[i].birkeland_ON == 0) ? false : true; ui_Ladder.rings_TOG_BV.isON = (att_Params[i].rings_ON == 0) ? false : true; ui_Ladder.attractor_Split_Perp_Dist_Slider.value = att_Params[i].split_dist; ui_Ladder.attractor_Inner_Radius_Slider.value = att_Params[i].inner_Radius = 12f; ui_Ladder.attractor_Outer_Radius_Slider.value = att_Params[i].outer_Radius = 144f; ui_Ladder.attractor_Linear_Amount_BV.isON = (att_Params[i].linear_ON == 0) ? false : true; ui_Ladder.attractor_Rota_Amount_BV.isON = (att_Params[i].rotational_ON == 0) ? false : true; ui_Ladder.attractor_Toro_Amount_BV.isON = (att_Params[i].toroidal_ON == 0) ? false : true; bool bRingsON = ui_Ladder.rings_TOG_BV.isON; ui_Ladder.rings_TOG_BV.isON = bRingsON; Show_Radial_Rings_Attractor(bRingsON,i); ui_Ladder.Set_Attractor_Slider_Enables_and_Disabled_Boxes_Internal(); VU_UI.GetComponent<VU_UI_Panel_Interface>().Update_current_Panel_Sliders(); } public void Reset_All_Attractors_From_Editor() { for (int i = 0; i < 20; i++) { att_GOs[i].transform.rotation = Quaternion.identity; att_Params[i].strength = 1f; att_GOs[i].GetComponent<Attractor_Show_Position>().set_Strength_Sphere_Compass_Scale(att_Params[i].strength); att_Params[i].radial_amount = 1f; att_Params[i].linear_amount = 0f; att_Params[i].linear_ON = 0; att_GOs[i].GetComponent<Attractor_Show_Position>().set_Axis_Scale(att_Params[i].linear_amount); att_Params[i].rotational_amount = 0f; att_Params[i].rotational_ON = 0; att_GOs[i].GetComponent<Attractor_Show_Position>().set_TorRaDial_Scale(att_Params[i].rotational_amount); att_Params[i].toroidal_amount = 0f; att_Params[i].toroidal_ON = 0; att_Params[i].split_dist = 1200f; att_Params[i].inner_Radius = 12f; att_Params[i].outer_Radius = 144f; att_Params[i].rings_ON = 0; att_GOs[i].GetComponent<Attractor_Show_Position>().SetRings_Radii(att_Params[i].inner_Radius, att_Params[i].outer_Radius); att_GOs[i].GetComponent<Rigidbody>().isKinematic = true;//Turn off Physics } int idx = nCurrent_Selected_Attractor = 0; Select_Attractor_for_Edit(0); ui_Ladder.attractor_Strength_Slider.value = att_Params[idx].strength; ui_Ladder.attractor_Radial_Amount_Slider.value = att_Params[idx].radial_amount; ui_Ladder.attractor_Linear_Amount_BV.isON = (att_Params[idx].linear_ON == 0) ? false : true; ui_Ladder.attractor_Linear_Amount_Slider.value = att_Params[idx].linear_amount; ui_Ladder.attractor_Rota_Amount_BV.isON = (att_Params[idx].rotational_ON == 0) ? false : true; ui_Ladder.attractor_rotational_amount_Slider.value = att_Params[idx].rotational_amount; ui_Ladder.attractor_Toro_Amount_BV.isON = (att_Params[idx].toroidal_ON == 0) ? false : true; ui_Ladder.attractor_toroidal_amount_Slider.value = att_Params[idx].toroidal_amount; ui_Ladder.birkeland_TOG_BV.isON = (att_Params[idx].birkeland_ON == 0) ? false : true; ui_Ladder.rings_TOG_BV.isON = (att_Params[idx].rings_ON == 0) ? false : true; ui_Ladder.attractor_Split_Perp_Dist_Slider.value = att_Params[idx].split_dist; ui_Ladder.attractor_Inner_Radius_Slider.value = att_Params[idx].inner_Radius = 12f; ui_Ladder.attractor_Outer_Radius_Slider.value = att_Params[idx].outer_Radius = 144f; ui_Ladder.attractor_Linear_Amount_BV.isON = (att_Params[idx].linear_ON == 0) ? false : true; ui_Ladder.attractor_Rota_Amount_BV.isON = (att_Params[idx].rotational_ON == 0) ? false : true; ui_Ladder.attractor_Toro_Amount_BV.isON = (att_Params[idx].toroidal_ON == 0) ? false : true; bool bRingsON = ui_Ladder.rings_TOG_BV.isON; ui_Ladder.rings_TOG_BV.isON = bRingsON; Show_Radial_Rings(bRingsON); ui_Ladder.Set_Attractor_Slider_Enables_and_Disabled_Boxes_Internal(); VU_UI.GetComponent<VU_UI_Panel_Interface>().Update_current_Panel_Sliders(); } public void Orient_Selected_Attractor() { att_GOs[nCurrent_Selected_Attractor].GetComponent<Rigidbody>().isKinematic = true; att_GOs[nCurrent_Selected_Attractor].transform.rotation = Quaternion.identity; att_Params[nCurrent_Selected_Attractor].vAxis = att_GOs[nCurrent_Selected_Attractor].transform.up; if (bAdjust_All_Attractors) { for (int i = 0; i < 20; i++) { att_GOs[i].GetComponent<Rigidbody>().isKinematic = true; att_GOs[i].transform.rotation = Quaternion.identity; att_Params[i].vAxis = att_GOs[nCurrent_Selected_Attractor].transform.up; } } } public void On_Orients_Plus_Button() { int curr_O = att_Params[nCurrent_Selected_Attractor].currentOrientation; if (++curr_O > 25) curr_O = 0; att_Params[nCurrent_Selected_Attractor].currentOrientation = curr_O; att_GOs[nCurrent_Selected_Attractor].GetComponent<Rigidbody>().isKinematic = true; att_GOs[nCurrent_Selected_Attractor].transform.rotation = Quaternion.Euler(vOrientation[curr_O]); if (bAdjust_All_Attractors) { for (int i = 0; i < 20; i++) { att_Params[i].currentOrientation = curr_O; att_GOs[i].GetComponent<Rigidbody>().isKinematic = true; att_GOs[i].transform.rotation = Quaternion.Euler(vOrientation[curr_O]); } } } public void OnShowAttractors() { bv_Show_Attractors.isON = !bv_Show_Attractors.isON; for (int i = 0; i < 20; i++) { att_GOs[i].GetComponent<Trigger_Attractor>().Show_Attractor_Egg(!bv_Show_Attractors.isON); } } public void OnAttractor_Set_Color(Color col, bool all) { att_GOs[nCurrent_Selected_Attractor].GetComponent<Trigger_Attractor>().SetColor(col); if(all) { for (int i = 0; i < 20; i++) { att_GOs[i].GetComponent<Trigger_Attractor>().SetColor(col); } } } public void On_Orients_30_Button(int axis) { Quaternion q = att_GOs[nCurrent_Selected_Attractor].transform.localRotation; Vector3 euler_Angles = q.eulerAngles; Quaternion qR = Quaternion.identity; att_GOs[nCurrent_Selected_Attractor].GetComponent<Rigidbody>().isKinematic = true; if (axis == 0)//X Axis { qR = Quaternion.Euler(new Vector3(30, 0, 0)); } else if(axis == 1)//Y Axis { qR = Quaternion.Euler(new Vector3(0, 30, 0)); } else if (axis == 2) { qR = Quaternion.Euler(new Vector3(0, 0, 30)); } att_GOs[nCurrent_Selected_Attractor].transform.localRotation *= qR; att_Params[nCurrent_Selected_Attractor].vAxis = att_GOs[nCurrent_Selected_Attractor].transform.up; //int curr_O = att_Params[nCurrent_Selected_Attractor].currentOrientation; //if (++curr_O > 25) curr_O = 0; //att_Params[nCurrent_Selected_Attractor].currentOrientation = curr_O; //att_GOs[nCurrent_Selected_Attractor].GetComponent<Rigidbody>().isKinematic = true; //att_GOs[nCurrent_Selected_Attractor].transform.rotation = Quaternion.Euler(vOrientation[curr_O]); //if (bAdjust_All_Attractors) //{ // for (int i = 0; i < 20; i++) // { // att_Params[i].currentOrientation = curr_O; // att_GOs[i].GetComponent<Rigidbody>().isKinematic = true; // att_GOs[i].transform.rotation = Quaternion.Euler(vOrientation[curr_O]); // } //} } public void On_Orients_Minus_Button() { int curr_O = att_Params[nCurrent_Selected_Attractor].currentOrientation; if (--curr_O < 0) curr_O = 25; att_Params[nCurrent_Selected_Attractor].currentOrientation = curr_O; att_GOs[nCurrent_Selected_Attractor].GetComponent<Rigidbody>().isKinematic = true; att_GOs[nCurrent_Selected_Attractor].transform.rotation = Quaternion.Euler(vOrientation[curr_O]); if (bAdjust_All_Attractors) { for (int i = 0; i < 20; i++) { att_Params[i].currentOrientation = curr_O; att_GOs[i].GetComponent<Rigidbody>().isKinematic = true; att_GOs[i].transform.rotation = Quaternion.Euler(vOrientation[curr_O]); } } } public void Set_Attractors_From_Serialize() { for (int i = 0; i < 20; i++) { att_GOs[i].GetComponent<Rigidbody>().isKinematic = true; att_Params[i].vAxis = att_GOs[i].transform.up; att_GOs[i].GetComponent<Attractor_Show_Position>().set_Axis_Scale(att_Params[i].linear_amount); att_GOs[i].GetComponent<Attractor_Show_Position>().set_TorRaDial_Scale(att_Params[i].rotational_amount); att_GOs[i].GetComponent<Attractor_Show_Position>().set_Strength_Sphere_Compass_Scale(att_Params[i].strength); if (att_Params[i].rings_ON == 1) { att_GOs[i].GetComponent<Attractor_Show_Position>().SetRings_Radii(att_Params[i].inner_Radius, att_Params[i].outer_Radius); } else { att_GOs[i].GetComponent<Attractor_Show_Position>().SetRings_Radii(0.000001f, 0.000001f); } } int idx = nCurrent_Selected_Attractor = 0; ui_Ladder.attractor_Strength_Slider.value = att_Params[idx].strength; ui_Ladder.attractor_Radial_Amount_Slider.value = att_Params[idx].radial_amount; ui_Ladder.attractor_Linear_Amount_Slider.value = att_Params[idx].linear_amount; ui_Ladder.attractor_rotational_amount_Slider.value = att_Params[idx].rotational_amount; ui_Ladder.attractor_toroidal_amount_Slider.value = att_Params[idx].toroidal_amount; ui_Ladder.attractor_Split_Perp_Dist_Slider.value = att_Params[idx].split_dist; ui_Ladder.attractor_Inner_Radius_Slider.value = att_Params[idx].inner_Radius; ui_Ladder.attractor_Outer_Radius_Slider.value = att_Params[idx].outer_Radius; ui_Ladder.attractor_Linear_Amount_BV.isON = (att_Params[idx].linear_ON == 0) ? false : true; ui_Ladder.attractor_Rota_Amount_BV.isON = (att_Params[idx].rotational_ON == 0) ? false : true; ui_Ladder.attractor_Toro_Amount_BV.isON = (att_Params[idx].toroidal_ON == 0) ? false : true; ui_Ladder.birkeland_TOG_BV.isON = (att_Params[idx].birkeland_ON == 0) ? false : true; ui_Ladder.rings_TOG_BV.isON = (att_Params[idx].rings_ON == 0) ? false : true; bool bRingsON = ui_Ladder.rings_TOG_BV.isON; ui_Ladder.rings_TOG_BV.isON = bRingsON; Show_Radial_Rings_Attractor(bRingsON, idx); ui_Ladder.Set_Attractor_Slider_Enables_and_Disabled_Boxes_Internal(); attractor_Selector_Inst.transform.parent = att_GOs[nCurrent_Selected_Attractor].transform; attractor_Selector_Inst.transform.localPosition = Vector3.zero; attractor_Selector_Inst.transform.localRotation = Quaternion.identity; } void onApplicationQuit() { //sWrite.Close(); } public Vector3 get_Att_GO_localPos(int idx) { return att_GOs[idx].transform.localPosition; } public Quaternion get_Att_GO_LocalRotation(int idx) { //if(idx == 0) print("q Get = " + att_GOs[idx].transform.localRotation.ToString("F2")); return att_GOs[idx].transform.localRotation; } public void set_ATT_GO_LocalPos(int idx, Vector3 pos) { att_GOs[idx].transform.localPosition = pos; } public void set_ATT_GO_LocalRotation(int idx, Vector3 axis, float w) { att_GOs[idx].GetComponent<Rigidbody>().isKinematic = true; Quaternion q; q.x = axis.x; q.y = axis.y; q.z = axis.z; q.w = w; att_GOs[idx].transform.localRotation = q; att_Params[idx].vAxis = att_GOs[idx].transform.up; if (idx == 0) { //print("q Set = " + q.ToString("F2")); //print("read it Back immediately"); //print("att_GOs[0].transform.localRotation = " + att_GOs[idx].transform.localRotation.ToString("F2")); } } public Quaternion get_ATT_GO_vAxis(int id) { att_Params[id].vAxis = att_GOs[id].transform.up; return att_GOs[id].transform.localRotation; } public void set_ATT_GO_vAxis(int idx, Vector3 axis, float w) { att_GOs[idx].GetComponent<Rigidbody>().isKinematic = true; Quaternion q; q.x = axis.x; q.y = axis.y; q.z = axis.z; q.w = w; att_GOs[idx].transform.localRotation = q; //att_Params[idx].vAxis = att_GOs[idx].transform.up; } public void set_Strength_Indicator_Compass_Selected(float val) { att_GOs[nCurrent_Selected_Attractor].GetComponent<Attractor_Show_Position>().set_Strength_Sphere_Compass_Scale(val); } public void set_Arrow_Val_Indicator_Selected(float val) { att_GOs[nCurrent_Selected_Attractor].GetComponent<Attractor_Show_Position>().set_Axis_Scale(val); } public void set_Inner_Outer_Radii() { int n = nCurrent_Selected_Attractor; att_GOs[n].GetComponent<Attractor_Show_Position>().SetRings_Radii(att_Params[n].inner_Radius, att_Params[n].outer_Radius); } public void Show_Radial_Rings(bool bShow) { att_Params[nCurrent_Selected_Attractor].rings_ON = bShow ? 1 : 0; for (int i = 0; i < 20; i++) { if (bShow) { //if ((att_Params[i].linear_ON != 0 || att_Params[i].rotational_ON != 0 || att_Params[i].toroidal_ON != 0)&(att_Params[i].rings_ON==1)) //{ att_GOs[i].GetComponent<Attractor_Show_Position>().Show_Radii(true); //} //else //{ // att_GOs[i].GetComponent<Attractor_Show_Position>().Show_Radii(false); //} } else { att_GOs[i].GetComponent<Attractor_Show_Position>().Show_Radii(false); } } } public void Show_Radial_Rings_Attractor(bool bShow,int idx) { att_Params[nCurrent_Selected_Attractor].rings_ON = bShow ? 1 : 0; if (bShow) { //if (att_Params[idx].linear_ON != 0 || att_Params[idx].rotational_ON != 0 || att_Params[idx].toroidal_ON != 0) //{ att_GOs[idx].GetComponent<Attractor_Show_Position>().Show_Radii(true); //} //else //{ // att_GOs[idx].GetComponent<Attractor_Show_Position>().Show_Radii(false); //} } else { att_GOs[idx].GetComponent<Attractor_Show_Position>().Show_Radii(false); } } public void set_TorRaDial_Val_Indicator_Selected(float val) { att_GOs[nCurrent_Selected_Attractor].GetComponent<Attractor_Show_Position>().set_TorRaDial_Scale(val); } public void Init_Attractors_From_Serialize() { Scale_Emitter_Collector_Attractors(ui_Ladder.scale_Emit_Collect_val); Set_Attractors_From_Serialize(); argos_Particle_Spawner.SetAttractorCount(nAttractorCount); int i; for (i = 0; i < nAttractorCount; i++) { att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void on_Button_Set_VU_UI_Position_Ctrl(int ctrl_no) { //VU_UI.Toggle_VU_UI(ctrl_no); //VU_UI.transform.position = ctrl1.transform.position+ ctrl1.transform.forward*30; //Quaternion q = ctrl1.transform.rotation; //q *= Quaternion.Euler(0, 180f, 0); //VU_UI.transform.rotation = q; } private void Grab_Menu(object sender, ControllerInteractionEventArgs e) { //Vector3 headLoc = get_Head_Transform().position; //uint controllerIndex = VRTK_DeviceFinder.GetControllerIndex(ctrl1); //if (controllerIndex == e.controllerIndex) //{ // grabingCtrl = ctrl1; //} //else grabingCtrl = ctrl2; //Vector3 vToCtrl = (grabingCtrl.transform.position - headLoc).normalized; //ui_Ladder.gameObject.GetComponent<Movable_Panel_Interface>().stop_any_Travel(); //if (Vector3.Dot(get_Head_Transform().up, vToCtrl) > 0.707) //{ // //ui_Ladder.transform.position = grabingCtrl.transform.position; // //ui_Ladder.transform.rotation = grabingCtrl.transform.rotation; // VU_UI.transform.position = grabingCtrl.transform.position; // Quaternion q = grabingCtrl.transform.rotation; // q *= Quaternion.Euler(0, 180f, 0); // VU_UI.transform.rotation = q; // bForceGrabOn = true; // bUI_Grabbed_Glass_Hold = true; //} } private void Grab_Menu_Release(object sender, ControllerInteractionEventArgs e) { //bForceGrabOn = false; } private void DoFileCaptcha(object sender, ControllerInteractionEventArgs e) { Serialize.Instance.onCaptcha(); } //private void Do_Show_Hide_VU_UI_1(object sender, ControllerInteractionEventArgs e) //{ // on_Button_Set_VU_UI_Position_Ctrl(1); //} //private void Do_Show_Hide_VU_UI_2(object sender, ControllerInteractionEventArgs e) //{ // on_Button_Set_VU_UI_Position_Ctrl(2); //} public void Indicate_Location(USER_LOCATION userLoc) { bv_Lab_Indicate.isON = false; bv_Phi_In_The_VU_Indicate.isON = false; bv_Lobby_Indicate.isON = false; //current_USER_LOCATION = userLoc; if (userLoc == USER_LOCATION.LOBBY) { bv_Lobby_Indicate.isON = true; } else if(userLoc == USER_LOCATION.LAB) { bv_Lab_Indicate.isON = true; } else { bv_Phi_In_The_VU_Indicate.isON = true; } } public void Set_USER_Location(USER_LOCATION userLoc) { current_USER_LOCATION = userLoc; Indicate_Location(userLoc); //if(userLoc == USER_LOCATION.LOBBY) //{ // Head_Monitor_Teleporter_On_Lobby(true); //} } public void Set_Miniature_Mode(bool bOn) { //print("zoom_scale = " + UI_Ladder.Instance.Zoom_Scale.ToString("F2")); active_Ctrl_States.bMINIATURE_Mode_On = bOn; if (bOn) { bv_Phi_In_The_VU_Indicate.isON = true; active_Ctrl_States.world_Scale = 1 / UI_Ladder.Instance.Zoom_Scale; if (active_Ctrl_States.bCtrl_1_On) { ctrl1.GetComponent<VRTK_StraightPointerRenderer>().scaleFactor = 0.002f; } if (active_Ctrl_States.bCtrl_2_On) { ctrl2.GetComponent<VRTK_StraightPointerRenderer>().scaleFactor = 0.002f; } } else { active_Ctrl_States.world_Scale = 1; //VU_UI.SetPointer_Tips_To_Scale(1); if (active_Ctrl_States.bCtrl_1_On) { ctrl1.GetComponent<VRTK_StraightPointerRenderer>().scaleFactor = 0.1f; } if (active_Ctrl_States.bCtrl_2_On) { ctrl2.GetComponent<VRTK_StraightPointerRenderer>().scaleFactor = 0.1f; } } } public void Teleport_to_Attractor_0()//IN THE VU { Indicate_Location(USER_LOCATION.IN_THE_VU); Set_Miniature_Mode(true); argos_Teleport.onTelePort_to(att_GOs[0].transform.position, false, false, false); ui_Ladder.transform.localScale = Vector3.one / ui_Ladder.Zoom_Scale; VU_UI.transform.localScale = vu_UI_Base_Scale / ui_Ladder.Zoom_Scale; } public void Teleport_to_THE_VU() { Indicate_Location(USER_LOCATION.IN_THE_VU); Set_Miniature_Mode(true); VU_UI.Editing(); if (current_USER_LOCATION == USER_LOCATION.LOBBY) { Vector3 vLookAt = start_Lab_LOOK_AT_GO.transform.position; Vector3 vTarget = start_Lab_HEAD_POSITION.transform.position; argos_Teleport.onTelePort_to_Position_Lookat_Guided_HEAD(vTarget, vLookAt, Vector3.up, Argos_Teleport.DESTINATION.TO_THE_VU, VU_UI.bUI_Is_On); ; } else if (current_USER_LOCATION == USER_LOCATION.LAB) { Vector3 vFwd = argos_Teleport.vive_Camera.transform.forward; Vector3 vPosition = argos_Teleport.vive_Camera.transform.position; Vector3 vLookAt = vPosition + 10 * vFwd; Vector3 vUP = gridSpace.transform.InverseTransformDirection(argos_Teleport.vive_Camera.transform.up); argos_Teleport.onTelePort_to_Position_Lookat_Guided_HEAD(vPosition, vLookAt, vUP, Argos_Teleport.DESTINATION.TO_THE_VU, VU_UI.bUI_Is_On); } } //public void Teleport_to_THE_VU_Before_Moving_To_Planet() //{ // Indicate_Location(USER_LOCATION.IN_THE_VU); // Set_Miniature_Mode(true); // VU_UI.Editing(); // Vector3 vHead_to_Floor = argos_Teleport.transform.position - Camera.main.transform.position; // Vector3 vHead_to_Focus = Camera.main.transform.forward * 0.33f; // Vector3 teleport_Floor_Location = Camera.main.transform.position + (vHead_to_Floor - vHead_to_Focus) / 75; // argos_Teleport.onTelePort_to(teleport_Floor_Location, false, false, true);///THROW EVENT //} bool bLobby_Scale_VU_CHK = false; public void Teleport_On_Three_Triggers()//THREE TRIGGERS { if (current_USER_LOCATION == USER_LOCATION.LOBBY) { bLobby_Scale_VU_CHK = !bLobby_Scale_VU_CHK; if(bLobby_Scale_VU_CHK) { Teleport_to_THE_VU_In_Place(); Indicate_Location(USER_LOCATION.LOBBY); } else { Teleport_to_LAB_In_Place(); Indicate_Location(USER_LOCATION.LOBBY); } } if (current_USER_LOCATION == USER_LOCATION.LAB) { Teleport_to_THE_VU_In_Place(); } else { Teleport_to_LAB_In_Place(); } } public void On_Center_Piece_Lobby() { bv_Lab_Indicate.isON = false; bv_Phi_In_The_VU_Indicate.isON = true; bv_Lobby_Indicate.isON = false; serialize.LoadPreset_toEditor(25,false); Teleport_to_Attractor_0(); StartCoroutine(defer_Teleport_to_Att_0_and_Launch()); } public void On_BV_PRESET_SELECT_TO_THE_VU(int preSet) { bv_Lab_Indicate.isON = false; bv_Phi_In_The_VU_Indicate.isON = true; bv_Lobby_Indicate.isON = false; serialize.LoadPreset_toEditor(preSet,false); StartCoroutine(defer_Teleport_to_VU()); } public void On_BV_PRESET_SELECT_TO_THE_LAB(int preset) { bv_Lab_Indicate.isON = true; bv_Phi_In_The_VU_Indicate.isON = false; bv_Lobby_Indicate.isON = false; serialize.LoadPreset_toEditor(preset,false); StartCoroutine(defer_Teleport_to_LAB()); } IEnumerator defer_Teleport_to_Att_0_and_Launch() { yield return new WaitForSeconds(0.1f); Teleport_to_Attractor_0(); vu_Time_Assembly.On_Launch_Spawner(); } IEnumerator defer_Teleport_to_VU() { yield return new WaitForSeconds(0.1f); Teleport_to_VU_BASE(); } IEnumerator defer_Teleport_to_LAB() { yield return new WaitForSeconds(0.1f); Teleport_to_LAB_BASE(); } IEnumerator defer_Teleport_to_LAB_and_Launch() { yield return new WaitForSeconds(0.1f); Teleport_to_LAB(); vu_Time_Assembly.On_Launch_Spawner(); } public void Teleport_to_LAB_BASE() { ARGOS_TRACE.Instance.Mark("-----------"); ARGOS_TRACE.Instance.Mark("Teleport_to_LAB_BASE()"); Indicate_Location(USER_LOCATION.LAB); Set_Miniature_Mode(false); VU_UI.Editing(); Vector3 vLookAt = start_Lab_LOOK_AT_GO.transform.position; Vector3 vTarget = start_Lab_HEAD_POSITION.transform.position; if (!argos_Teleport.bTeleporting_Now) { argos_Teleport.onTelePort_to_Position_Lookat_Guided_HEAD(vTarget, vLookAt, Vector3.up, Argos_Teleport.DESTINATION.TO_THE_LAB, VU_UI.bUI_Is_On); } if (solar_System_Base.bPlanets_Solar_System_On && VU_UI.Panel_ID() == VU_UI_MANAGER.PANEL_IDS.PN_EU_2017_SOLAR_SYSTEM) { planet_Ride.Scale_Base_Back_To_Lab(); } } public void Teleport_to_VU_BASE() { ARGOS_TRACE.Instance.Mark("-----------"); ARGOS_TRACE.Instance.Mark("Teleport_to_VU_BASE()"); Indicate_Location(USER_LOCATION.IN_THE_VU); Set_Miniature_Mode(true); VU_UI.Editing(); Vector3 vLookAt = start_Lab_LOOK_AT_GO.transform.position; Vector3 vTarget = start_Lab_HEAD_POSITION.transform.position; if (!argos_Teleport.bTeleporting_Now) { argos_Teleport.onTelePort_to_Position_Lookat_Guided_HEAD(vTarget, vLookAt, Vector3.up, Argos_Teleport.DESTINATION.TO_THE_VU, VU_UI.bUI_Is_On); } if (solar_System_Base.bPlanets_Solar_System_On && VU_UI.Panel_ID() == VU_UI_MANAGER.PANEL_IDS.PN_EU_2017_SOLAR_SYSTEM) { planet_Ride.Scale_Base_Back_To_Lab(); } } public void Teleport_to_THE_VU_In_Place() { //ARGOS_TRACE.Instance.Mark("-----------"); //ARGOS_TRACE.Instance.Mark("Teleport_to_THE_VU_In_Place"); Indicate_Location(USER_LOCATION.IN_THE_VU); Set_Miniature_Mode(true); VU_UI.Editing(); Camera vive_camera = argos_Teleport.vive_Camera; Vector3 vLookAt = vive_camera.transform.position + vive_camera.transform.forward; Vector3 vTarget = vive_camera.transform.position - 10f * vive_camera.transform.forward; Vector3 vUP = gridSpace.transform.InverseTransformDirection(argos_Teleport.vive_Camera.transform.up); if (!argos_Teleport.bTeleporting_Now) { argos_Teleport.onTelePort_to_Position_Lookat_Guided_HEAD(vTarget, vLookAt, vUP, Argos_Teleport.DESTINATION.TO_THE_VU, VU_UI.bUI_Is_On); } if (solar_System_Base.bPlanets_Solar_System_On && VU_UI.Panel_ID() == VU_UI_MANAGER.PANEL_IDS.PN_EU_2017_SOLAR_SYSTEM) { planet_Ride.Scale_Base_Back_To_Lab(); } } public void Teleport_to_LAB_In_Place() { //ARGOS_TRACE.Instance.Mark("-----------"); //ARGOS_TRACE.Instance.Mark("Teleport_to_LAB_In_Place"); Indicate_Location(USER_LOCATION.LAB); Set_Miniature_Mode(false); VU_UI.Editing(); Camera vive_camera = argos_Teleport.vive_Camera; Vector3 vLookAt = vive_camera.transform.position + vive_camera.transform.forward; Vector3 vTarget = vive_camera.transform.position - 10f*vive_camera.transform.forward; Vector3 vUp = gridSpace.transform.InverseTransformDirection(vive_camera.transform.up); if (!argos_Teleport.bTeleporting_Now) { argos_Teleport.onTelePort_to_Position_Lookat_Guided_HEAD(vTarget, vLookAt, vUp, Argos_Teleport.DESTINATION.TO_THE_LAB, VU_UI.bUI_Is_On); } if (solar_System_Base.bPlanets_Solar_System_On && VU_UI.Panel_ID() == VU_UI_MANAGER.PANEL_IDS.PN_EU_2017_SOLAR_SYSTEM) { planet_Ride.Scale_Base_Back_To_Lab(); } } public void Teleport_to_LOBBY() { ARGOS_TRACE.Instance.Mark("-----------"); ARGOS_TRACE.Instance.Mark("Teleport_to_LOBBY()"); Indicate_Location(USER_LOCATION.LOBBY); Set_Miniature_Mode(false); VU_UI.Editing(); //VU_UI_Visor.Set_UI_at_Start_Position(); Vector3 vLookAt = start_Lobby_LOOK_AT_GO.transform.position; Vector3 vTarget = start_Lobby_HEAD_POSITION.transform.position; argos_Teleport.onTelePort_to_Position_Lookat_Guided_HEAD(vTarget, vLookAt, Vector3.up, Argos_Teleport.DESTINATION.TO_THE_LOBBY, false); //VU_UI_Visor.Teleport_VU_UI_To_Start_Position(); } public void Teleport_to_LAB() { ARGOS_TRACE.Instance.Mark("-----------"); ARGOS_TRACE.Instance.Mark("Teleport_to_LAB()"); if (current_USER_LOCATION == USER_LOCATION.LOBBY) { Indicate_Location(USER_LOCATION.LAB); Set_Miniature_Mode(false); VU_UI.Editing(); //argos_Teleport.onTelePort_to(Vector3.zero, true, true, false); argos_Teleport.onTelePort_to_Lookat_at_Radius_Guided_HEAD(gridSpace, 70, true, true); } else if(current_USER_LOCATION == USER_LOCATION.IN_THE_VU) { Indicate_Location(USER_LOCATION.LAB); Set_Miniature_Mode(false); bUI_Grabbed_Glass_Hold = true; if(solar_System_Base.bPlanets_Solar_System_On && VU_UI.Panel_ID() == VU_UI_MANAGER.PANEL_IDS.PN_EU_2017_SOLAR_SYSTEM) { planet_Ride.Scale_Base_Back_To_Lab(); } //Vector3 vHead_to_Floor = argos_Teleport.transform.position - Camera.main.transform.position; //Vector3 vHead_to_Focus = Camera.main.transform.forward*0.33f; //Vector3 teleport_Floor_Location = Camera.main.transform.position + 75*(vHead_to_Floor - vHead_to_Focus); argos_Teleport.onTelePort_to_Lookat_at_Radius_Guided_HEAD(gridSpace, 70, true, false); } //ui_Ladder.transform.localScale = Vector3.one; //ui_Ladder.return_to_Start_Position(); //VU_UI.transform.localScale = vu_UI_Base_Scale; } public USER_LOCATION Get_Current_USER_Location() { return current_USER_LOCATION; } //public void OnTeleport_to_WayPoint(int idx) //{ // Set_Miniature_Mode(false); // Indicate_Location(USER_LOCATION.LAB); // VU_UI.transform.SetParent(argos_Teleport.transform); // WayPoints.Instance.transform.SetParent(argos_Teleport.transform); // argos_Teleport.Teleport_to_WayPoint(idx); //} public void Teleport_to_Attractor_0_Preset_Selection(int sel) { Indicate_Location(USER_LOCATION.IN_THE_VU); Set_Miniature_Mode(true); argos_Teleport.onTelePort_to(att_GOs[0].transform.position, false , true, false); //ui_Ladder.transform.localScale = Vector3.one / ui_Ladder.Zoom_Scale; VU_UI.transform.localScale = vu_UI_Base_Scale / ui_Ladder.Zoom_Scale; //VU_UI.SetPointer_Tips_To_Scale(1/ui_Ladder.Zoom_Scale) } public void Teleport_to_Selected_Attractor() { Indicate_Location(USER_LOCATION.IN_THE_VU); Set_Miniature_Mode(true); argos_Teleport.onTelePort_to(att_GOs[nCurrent_Selected_Attractor].transform.position, false, false, false); ui_Ladder.transform.localScale = Vector3.one / ui_Ladder.Zoom_Scale; VU_UI.transform.localScale = vu_UI_Base_Scale / ui_Ladder.Zoom_Scale; //VU_UI.SetPointer_Tips_To_Scale(1 / ui_Ladder.Zoom_Scale); } private void Place_Attractor_Spawn_VU_Add(GameObject ctrl) { if (att_GOs[nAttractorCount].transform.parent == ctrl.transform) { att_GOs[nAttractorCount].transform.SetParent(collector_BaseGO.transform); } } private void Add_Attractor_At_Controller_Tip(GameObject ctrl) { if (att_GOs[nAttractorCount].transform.parent == ctrl.transform) { att_GOs[nAttractorCount].transform.SetParent(collector_BaseGO.transform); } if (nAttractorCount < 19) { nAttractorCount++; } argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Vector3 v = new Vector3(0, 0, 0); att_GOs[nAttractorCount].transform.SetParent(ctrl.transform); att_GOs[nAttractorCount].transform.localPosition = v; att_GOs[nAttractorCount].SetActive(true); } public void Set_Most_Recent_Interacting_Controller(GameObject ctrl) { most_Recent_Interacting_Controller = ctrl; } public GameObject Get_Most_Recent_Interacting_Controller() { return most_Recent_Interacting_Controller; } public void Set_Flight_Tog(bool bOn) { vu_Time_Assembly.flight_BV.isON = bOn; } private void DoTriggerPressed(object sender, ControllerInteractionEventArgs e) { GameObject ctrl = ((VRTK_ControllerEvents)sender).gameObject; GameObject goOver = null; if (ctrl == ctrl1) { active_Ctrl_States.bTrigger_1_Pressed = true; } else if (ctrl == ctrl2) { active_Ctrl_States.bTrigger_2_Pressed = true; } most_Recent_Interacting_Controller = ctrl; //if (vu_Spawn_Control.mode == Vu_Spawn_Control.SPAWN_MODE.ADD_ATTRACTOR) //{ // Add_Attractor_At_Controller_Tip(ctrl); //} goOver = ctrl.GetComponent<ArgosVU_VRTK_ControllerPointerEvents_Listener>().Get_goOver(); if (goOver != null) { for (int i = 0; i < att_GOs.Length; i++) { if (goOver == att_GOs[i]) { VU_UI.Editing(); bv_Lab_Indicate.isON = false; bv_Phi_In_The_VU_Indicate.isON = true; bv_Lobby_Indicate.isON = false; Indicate_Location(USER_LOCATION.IN_THE_VU); Set_Miniature_Mode(true); Get_Most_Recent_Interacting_Controller().GetComponent<ArgosVU_VRTK_ControllerPointerEvents_Listener>().Haptic_Single(0.1f); Vector3 vLookAt = att_GOs[i].transform.position; Vector3 vFWD = (att_GOs[i].transform.position - argos_Teleport.vive_Camera.transform.position).normalized; Vector3 vTarget = vLookAt - vFWD * fTeleport_Attractor_Dist; Vector3 vUp = gridSpace.transform.InverseTransformDirection(argos_Teleport.vive_Camera.transform.up); argos_Teleport.onTelePort_to_Position_Lookat_Guided_HEAD(vTarget, vLookAt, vUp, Argos_Teleport.DESTINATION.TO_THE_VU, VU_UI.bUI_Is_On); ui_Ladder.transform.localScale = Vector3.one / ui_Ladder.Zoom_Scale; VU_UI.transform.localScale = vu_UI_Base_Scale / ui_Ladder.Zoom_Scale; //VU_UI.SetPointer_Tips_To_Scale(1 / ui_Ladder.Zoom_Scale); nCurrent_Selected_Attractor = i; Select_Attractor_for_Edit(i); ctrl.GetComponent<ArgosVU_VRTK_ControllerPointerEvents_Listener>().Clear_goOver(); //ctrl.GetComponent<VRTK_SimplePointer>().Clear_Pointer_Over(); return; } } for (int i = 0; i < ptp_GOs.Length; i++) { if (goOver == ptp_GOs[i]) { planet_Ride.Teleport_To_Planet(ptp_GOs[i],current_USER_LOCATION); Set_Miniature_Mode(true); ui_Ladder.transform.localScale = Vector3.one / ui_Ladder.Zoom_Scale;//Possible Albatross VU_UI.transform.localScale = vu_UI_Base_Scale / ui_Ladder.Zoom_Scale; VU_UI.Editing(); ctrl.GetComponent<ArgosVU_VRTK_ControllerPointerEvents_Listener>().Clear_goOver(); return; } } if (goOver == emitter_Source)//LAUNCH Particle System { UI_Ladder.Instance.onSpawn_Launch(); //ctrl.GetComponent<VRTK_SimplePointer>().Clear_Pointer_Over(); } //else //{ // if (goOver == monad_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_Monad_Attractor(); // } // else if (goOver == diad_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_Diad_Attractor(); // } // else if (goOver == triad_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_Triad_Attractor(); // } // else if (goOver == tetra_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_Tetra_Attractors(); // } // else if (goOver == octa_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_Octa_Attractors(); // } // else if (goOver == hexa_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_Hexa_Attractors(); // } // else if (goOver == merk_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_Merkaba_Attractors(); // } // else if (goOver == cubeOct_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_CubeOct_Attractors(); // } // else if (goOver == icosa_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_Icosa_Attractors(); // } // else if (goOver == dodec_Ball) // { // Reset_All_Attractors_From_Editor(); // Set_Dodec_Attractors(); // } //} ctrl.GetComponent<ArgosVU_VRTK_ControllerPointerEvents_Listener>().Clear_goOver(); } } private void DoTriggerReleased(object sender, ControllerInteractionEventArgs e) { GameObject ctrl = ((VRTK_ControllerEvents)sender).gameObject; if (ctrl == ctrl1) { active_Ctrl_States.bTrigger_1_Pressed = false; } else if (ctrl == ctrl2) { active_Ctrl_States.bTrigger_2_Pressed = false; } } private void DoTouchpadPressed(object sender, ControllerInteractionEventArgs e) { GameObject ctrl = ((VRTK_ControllerEvents)sender).gameObject; if (ctrl == ctrl1) { active_Ctrl_States.bTouchpad_1_Pressed = true; } else if (ctrl == ctrl2) { active_Ctrl_States.bTouchpad_2_Pressed = true; } } private void DoTouchpadReleased(object sender, ControllerInteractionEventArgs e) { GameObject ctrl = ((VRTK_ControllerEvents)sender).gameObject; if (ctrl == ctrl1) { active_Ctrl_States.bTouchpad_1_Pressed = false; } else if (ctrl == ctrl2) { active_Ctrl_States.bTouchpad_2_Pressed = false; } } private void DoTouchpadTouchStart(object sender, ControllerInteractionEventArgs e) { GameObject ctrl = ((VRTK_ControllerEvents)sender).gameObject; if (ctrl == ctrl1) { active_Ctrl_States.bTouchpad_1_Touched = true; } else if (ctrl == ctrl2) { active_Ctrl_States.bTouchpad_2_Touched = true; } } private void DoTouchpadTouchEnd(object sender, ControllerInteractionEventArgs e) { GameObject ctrl = ((VRTK_ControllerEvents)sender).gameObject; if (ctrl == ctrl1) { active_Ctrl_States.bTouchpad_1_Touched = false; } else if (ctrl == ctrl2) { active_Ctrl_States.bTouchpad_2_Touched = false; } } public void SetAttractors(int attractor_Count) { Reset_All_Attractors_From_Editor(); nAttractorCount = 0; if (attractor_Count == 0) { nAttractorCount = 0; } else if(attractor_Count == 1) { Set_Monad_Attractor(); } else if(attractor_Count == 2) { Set_Diad_Attractor(); } else if(attractor_Count == 3) { Set_Triad_Attractor(); } else if(attractor_Count == 4) { Set_Tetra_Attractors(); } } public void Set_Platonics_Button_Indicators(int nAC) { monad_Ball.GetComponent<Button_VU>().isON = false; diad_Ball.GetComponent<Button_VU>().isON = false; triad_Ball.GetComponent<Button_VU>().isON = false; tetra_Ball.GetComponent<Button_VU>().isON = false; octa_Ball.GetComponent<Button_VU>().isON = false; hexa_Ball.GetComponent<Button_VU>().isON = false; merk_Ball.GetComponent<Button_VU>().isON = false; cubeOct_Ball.GetComponent<Button_VU>().isON = false; icosa_Ball.GetComponent<Button_VU>().isON = false; dodec_Ball.GetComponent<Button_VU>().isON = false; five_2D_Ball.GetComponent<Button_VU>().isON = false; seven_2D_Ball.GetComponent<Button_VU>().isON = false; nAttractorCount = nAC; current_Platonic_Selected = Get_Platonic_Type(nAC); if (nAC == 1) { monad_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 2) { diad_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 3) { triad_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 5) { five_2D_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 7) { seven_2D_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 4) { tetra_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 6) { octa_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 8)//Two Possible { hexa_Ball.GetComponent<Button_VU>().isON = true; merk_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 13) { cubeOct_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 12) { icosa_Ball.GetComponent<Button_VU>().isON = true; } else if (nAC == 20) { dodec_Ball.GetComponent<Button_VU>().isON = true; } } public void onPlatonicTouched(int type) { ui_Ladder.onAppMode_From_Settings_Selectors(0); monad_Ball.GetComponent<Button_VU>().isON = false; diad_Ball.GetComponent<Button_VU>().isON = false; triad_Ball.GetComponent<Button_VU>().isON = false; tetra_Ball.GetComponent<Button_VU>().isON = false; octa_Ball.GetComponent<Button_VU>().isON = false; hexa_Ball.GetComponent<Button_VU>().isON = false; merk_Ball.GetComponent<Button_VU>().isON = false; cubeOct_Ball.GetComponent<Button_VU>().isON = false; icosa_Ball.GetComponent<Button_VU>().isON = false; dodec_Ball.GetComponent<Button_VU>().isON = false; five_2D_Ball.GetComponent<Button_VU>().isON = false; seven_2D_Ball.GetComponent<Button_VU>().isON = false; current_Platonic_Selected = (Platonic_Selector_Injector.type)type; Reset_All_Attractors_From_Editor(); //Reset_All_Attractors_From_Editor(); if (type == (int)Platonic_Selector_Injector.type.MONAD) { Set_Monad_Attractor(); monad_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.DIAD) { Set_Diad_Attractor(); diad_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.TRIAD) { Set_Triad_Attractor(); triad_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.FIVE_2D) { Set_Five_Attractors(); five_2D_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.SEVEN_2D) { Set_Seven_Attractors(); seven_2D_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.TETRAHEDRON) { Set_Tetra_Attractors(); tetra_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.OCTAHEDRON) { Set_Octa_Attractors(); octa_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.HEXAHEDRON) { Set_Hexa_Attractors(); hexa_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.MERKABA) { Set_Merkaba_Attractors(); merk_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.CUBEOCTAHEDRON) { Set_CubeOct_Attractors(); cubeOct_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.ICOSAHEDRON) { Set_Icosa_Attractors(); icosa_Ball.GetComponent<Button_VU>().isON = true; } else if (type == (int)Platonic_Selector_Injector.type.DODECAHEDRON) { Set_Dodec_Attractors(); dodec_Ball.GetComponent<Button_VU>().isON = true; } //else if (type == (int)Platonic_Selector_Injector.type.PENDULUM) //{ // Reset_All_Attractors_From_Editor(); // ui_Ladder.set_App_Mode(UI_Ladder.App_Mode.PENDULUM); // Reset_Toys(); // pendulum_Ball.GetComponent<Button_VU>().isON = true; // VU_UI.Get_VU_Panel_Interface().Select_Panel(11); // SetPendulum_Mode(); //} //else if (type == (int)Platonic_Selector_Injector.type.FRISBEE) //{ // Reset_All_Attractors_From_Editor(); // ui_Ladder.set_App_Mode(UI_Ladder.App_Mode.FRISBEE); // Reset_Toys(); // frisbee_Ball.GetComponent<Button_VU>().isON = true; // VU_UI.Get_VU_Panel_Interface().Select_Panel(11); // SetFrisbee_Mode(); //} } public void onPlatonicTouched(Platonic_Selector_Injector.type type) { current_Platonic_Selected = type; int iType = (int)type; if (iType == (int)Platonic_Selector_Injector.type.MONAD) { Reset_All_Attractors_From_Editor(); Set_Monad_Attractor(); } else if (iType == (int)Platonic_Selector_Injector.type.DIAD) { Reset_All_Attractors_From_Editor(); Set_Diad_Attractor(); } else if (iType == (int)Platonic_Selector_Injector.type.TRIAD) { Reset_All_Attractors_From_Editor(); Set_Triad_Attractor(); } else if (iType == (int)Platonic_Selector_Injector.type.TETRAHEDRON) { Reset_All_Attractors_From_Editor(); Set_Tetra_Attractors(); } else if (iType == (int)Platonic_Selector_Injector.type.OCTAHEDRON) { Reset_All_Attractors_From_Editor(); Set_Octa_Attractors(); } else if (iType == (int)Platonic_Selector_Injector.type.HEXAHEDRON) { Reset_All_Attractors_From_Editor(); Set_Hexa_Attractors(); } else if (iType == (int)Platonic_Selector_Injector.type.MERKABA) { Reset_All_Attractors_From_Editor(); Set_Merkaba_Attractors(); } else if (iType == (int)Platonic_Selector_Injector.type.CUBEOCTAHEDRON) { Reset_All_Attractors_From_Editor(); Set_CubeOct_Attractors(); } else if (iType == (int)Platonic_Selector_Injector.type.ICOSAHEDRON) { Reset_All_Attractors_From_Editor(); Set_Icosa_Attractors(); } else if (iType == (int)Platonic_Selector_Injector.type.DODECAHEDRON) { Reset_All_Attractors_From_Editor(); Set_Dodec_Attractors(); } else if (iType == (int)Platonic_Selector_Injector.type.MONAD) { Reset_All_Attractors_From_Editor(); Set_Monad_Attractor(); } else if (iType == (int)Platonic_Selector_Injector.type.DIAD) { Reset_All_Attractors_From_Editor(); Set_Diad_Attractor(); } else if (iType == (int)Platonic_Selector_Injector.type.TRIAD) { Reset_All_Attractors_From_Editor(); Set_Triad_Attractor(); } } public void OnSpawnGeometry_Touched(Argos_Particle_Spawner.Particle_Type type) { argos_Particle_Spawner.Set_Geometry_Shader_Material(type); } public void OnSpawnGeometry_Touched_From_Button(int type) { argos_Particle_Spawner.gameObject.GetComponent<Spawn_Geometry_Selector_Injector>().Select_Active_Geometry_Buttons_To_Indicate(type); argos_Particle_Spawner.Set_Geometry_Shader_Material((Argos_Particle_Spawner.Particle_Type)type); } public void SetPlatonic_Mode() { //From Mode change in UI_Ladder Reset_All_Attractors_From_Editor(); Set_Tetra_Attractors(); } public void SetPendulum_Mode() { nAttractorCount = 1; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); for (int j = 0; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void SetFrisbee_Mode() { nAttractorCount = 2; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); for (int j = 0; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public float Get_Grid_Height() { return gridSpace.transform.position.y; } public void SetEmitter_Collector_Active(bool bActive) { if (bActive) { emitter_Source.SetActive(true); collector_Source.SetActive(true); } else { emitter_Source.SetActive(false); collector_Source.SetActive(false); } } public void CoLocate_Emitter_Collector() { Quaternion q = Quaternion.identity; Vector3 vOrigin = gridSpace.transform.position; emitter_Source.transform.rotation = q; collector_Source.transform.rotation = q; centerSphere.transform.rotation = q; emitter_Source.transform.position = vOrigin; collector_Source.transform.position = vOrigin; centerSphere.transform.position = vOrigin; collector_Source.GetComponent<Collector_Rotation>().OnReset_Rotation_Slider(0); collector_Source.GetComponent<Collector_Rotation>().OnReset_Rotation_Slider(1); collector_Source.GetComponent<Collector_Rotation>().OnReset_Rotation_Slider(2); collector_Source.GetComponent<Rigidbody>().constraints = (RigidbodyConstraints.FreezeAll); StartCoroutine(Wait_To_UnConstrain()); } IEnumerator Wait_To_UnConstrain() { yield return new WaitForSeconds(0.1f); Rigidbody rb; rb = collector_Source.GetComponent<Rigidbody>(); rb.constraints = (RigidbodyConstraints.None); rb.isKinematic = false; StopCoroutine(Wait_To_UnConstrain()); } public void OnScale_MERC() { Vector3 v = Vector3.one; v *= scale_MERC_Slider.value; emitter_Source.transform.GetComponentInChildren<Tools_Scaler>().transform.localScale = v * emit_collect_Relative_Scale; collector_Source.transform.GetComponentInChildren<Tools_Scaler>().transform.localScale = v * emit_collect_Relative_Scale; centerSphere.transform.localScale = 2.663f * v * emit_collect_Relative_Scale; } public void Scale_Emitter_Collector_Attractors(float scale)//MANIPULATORS - TOOLS { Vector3 v = Vector3.one; //TEMP //scale = 1; v *= scale; emitter_Source.transform.GetComponentInChildren<Tools_Scaler>().transform.localScale = v * emit_collect_Relative_Scale; collector_Source.transform.GetComponentInChildren<Tools_Scaler>().transform.localScale = v * emit_collect_Relative_Scale; centerSphere.transform.localScale = 2.663f * v * emit_collect_Relative_Scale; //if (scale < 0.1f) //{ // emitter_Handle.SetActive(false); // //collector_Handle.SetActive(false); //} //else //{ // emitter_Handle.SetActive(true); // //collector_Handle.SetActive(true); //} GameObject go; for (int j = 0; j < att_GOs.Length; j++) { att_GOs[j].GetComponent<SphereCollider>().radius = v.x * attractors_Relative_Scale; go = att_GOs[j].transform.GetComponentInChildren<Tools_Scaler>().gameObject; go.transform.localScale = v * attractors_Relative_Scale; //att_GOs[j].GetComponent<Attractor_Show_Position>().setPhantom_Scaler(go); } attractor_Selector_Inst.transform.localScale = v * attractors_Relative_Scale * 1.12f; } public void Adjust_Attractor_Scale(float delta_Scale)//POSITIONS { Vector3 vPos; float rad; for (int i = 0; i < att_GOs.Length; i++) { if (att_GOs[i].activeSelf) { vPos = att_GOs[i].transform.localPosition; rad = vPos.magnitude; vPos.Normalize(); vPos *= (1 + delta_Scale); vPos *= rad; att_GOs[i].transform.localPosition = vPos; } } } public void build_Geometry_Lists() { Load_Dodecahedron_List(attractor_start_radius); Load_TetraHedron_List(attractor_start_radius); Load_OctaHedron_List(attractor_start_radius); Load_HexaHedron_List(attractor_start_radius); Load_Merkaba_List(attractor_start_radius); Load_CubeOctahedron_List(attractor_start_radius); Load_Icosahedron_List(attractor_start_radius); Load_Five_List(attractor_start_radius); Load_Seven_List(attractor_start_radius); Load_Triad_List(attractor_start_radius); Quaternion q = Quaternion.identity; for (int i = 0; i < 20; i++) { att_GOs[i] = (GameObject)Instantiate(attractor_point, dodec_Verts[i], q); att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = dodec_Verts[i]; att_GOs[i].GetComponent<Attractor_Show_Position>().Set_My_Index(i); att_GOs[i].GetComponent<Attractor_Show_Position>().bScaleCollider = true; att_Params[i] = new Att_Params(); } ptp_GOs = new GameObject[planets.Length]; for(int i = 0; i<planets.Length; i++) { ptp_GOs[i] = GameObject.Instantiate(planet_Teleporter_Prefab, planets[i].transform.position, planets[i].transform.rotation,solar_System_HANDLE.transform); ptp_GOs[i].GetComponent<Planet_TELEPORTER>().Set_My_Index(i); ptp_GOs[i].GetComponent<Planet_TELEPORTER>().bScaleCollider = true; } } public void OnBV_Teleport_to_Hover_Over_Planet(int idx) { //SCALE - TELEPORTED //ATTACH AT RADIUS of PLANET //SET MODE VU_UI.Editing(); planet_Ride.Teleport_To_Planet(ptp_GOs[idx],current_USER_LOCATION); //bv_Lab_Indicate.isON = false; //bv_Phi_In_The_VU_Indicate.isON = true; //bv_Lobby_Indicate.isON = false; ////ui_Ladder.Zoom_Scale = 120f; //Set_Miniature_Mode(true); //Vector3 vHead_to_Down_Attractor = argos_Teleport.transform.position - Camera.main.transform.position; //Vector3 vHead_to_Focus = Camera.main.transform.forward * 161.803f;//:) //Vector3 teleport_Observe_Location = ptp_GOs[idx].transform.position + (vHead_to_Down_Attractor - vHead_to_Focus) / 120; //argos_Teleport.onTelePort_to(teleport_Observe_Location, false, false); //ui_Ladder.transform.localScale = Vector3.one / ui_Ladder.Zoom_Scale; //VU_UI.transform.localScale = vu_UI_Base_Scale / ui_Ladder.Zoom_Scale; } public void Load_Dodecahedron_List(float radius) { float magicAngle1 = Mathf.PI * 52.62263590f / 180; float magicAngle2 = Mathf.PI * 10.81231754f / 180; float segmentAngle = Mathf.PI * 2 / 5; float currentAngle = 0f; for (var i = 0; i < 5; i++) { dodec_Verts.Add(PTUtils.PointOnSphere(radius, currentAngle, -magicAngle1)); dodec_Verts.Add(PTUtils.PointOnSphere(radius, currentAngle, -magicAngle2)); currentAngle -= segmentAngle; } currentAngle = -segmentAngle / 2; for (var i = 0; i < 5; i++) { dodec_Verts.Add(PTUtils.PointOnSphere(radius, currentAngle, magicAngle1)); dodec_Verts.Add(PTUtils.PointOnSphere(radius, currentAngle, magicAngle2)); currentAngle -= segmentAngle; } } //XY PLANE public static Vector3 PointOnCircle3_XY(float radius, float angle) { return new Vector3(radius * Mathf.Sin(angle), radius * Mathf.Cos(angle), 0); } public static Vector3 PointOnCircle3_XY2(float radius, float angle) { return new Vector3(radius * Mathf.Cos(angle), radius * Mathf.Sin(angle), 0); } public static Vector3 PointOnCircle3_XZ(float radius, float angle) { return new Vector3(radius * Mathf.Sin(angle), 0, radius * Mathf.Cos(angle)); } public static Vector3 PointOnCircle3_XZ2(float radius, float angle) { return new Vector3(radius * Mathf.Cos(angle), 0, radius * Mathf.Sin(angle)); } public void Load_Triad_List(float radius) { float triad_Angle = Mathf.PI / 1.5f; float curr_Angle = 0; for (int i = 0; i < 5; i++) { triad_Verts.Add(PointOnCircle3_XZ(radius, curr_Angle)); curr_Angle += triad_Angle; } } public void Load_Five_List(float radius) { float pent_Angle = Mathf.PI / 2.5f; float curr_Angle = 0; for(int i = 0; i<5; i++) { five_Verts.Add(PointOnCircle3_XZ(radius, curr_Angle)); curr_Angle += pent_Angle; } } public void Load_Seven_List(float radius) { Vector3 vSmall_Up = 1.0E-12f*Vector3.up; seven_Verts.Add(vSmall_Up);//Center attractor float angle6 = Mathf.PI / 3f; float curr_Angle = Mathf.PI / 6f; for(int i = 0; i<6; i++) { seven_Verts.Add(PointOnCircle3_XZ2(radius, curr_Angle)+ vSmall_Up); curr_Angle += angle6; } } public void Load_TetraHedron_List(float radius) { float tetrahedralAngle = Mathf.PI * -19.471220333f / 180; float segmentAngle = Mathf.PI * 2 / 3; float currentAngle = 0f; Vector3 v = new Vector3(0, radius, 0); tetra_Verts.Add(v); for (var i = 1; i < 4; i++) { tetra_Verts.Add(PTUtils.PointOnSphere(radius, currentAngle, tetrahedralAngle)); currentAngle += segmentAngle; } } public void Load_Merkaba_List(float radius) { float tetrahedralAngle = Mathf.PI * -19.471220333f / 180; float segmentAngle = Mathf.PI * 2 / 3; float currentAngle = 0f; Vector3 v = new Vector3(0, radius, 0); merk_Verts.Add(v); for (var i = 1; i < 4; i++) { merk_Verts.Add(PTUtils.PointOnSphere(radius, currentAngle, tetrahedralAngle)); currentAngle += segmentAngle; } v = new Vector3(0, -radius, 0); merk_Verts.Add(v); currentAngle = 0f; for (var i = 1; i < 4; i++) { merk_Verts.Add(PTUtils.PointOnSphere(-radius, currentAngle, tetrahedralAngle)); currentAngle += segmentAngle; } } public void Load_OctaHedron_List(float radius) { octa_Verts.Add(new Vector3(radius, 0, 0)); octa_Verts.Add(new Vector3(-radius, 0, 0)); octa_Verts.Add(new Vector3(0, radius, 0)); octa_Verts.Add(new Vector3(0, -radius, 0)); octa_Verts.Add(new Vector3(0, 0, radius)); octa_Verts.Add(new Vector3(0, 0, -radius)); } public void Load_HexaHedron_List(float radius) { float side = radius / Mathf.Sqrt(3); hexa_Verts.Add(new Vector3(-side, -side, -side)); hexa_Verts.Add(new Vector3(-side, side, -side)); hexa_Verts.Add(new Vector3(-side, -side, side)); hexa_Verts.Add(new Vector3(-side, side, side)); hexa_Verts.Add(new Vector3(side, -side, -side)); hexa_Verts.Add(new Vector3(side, side, -side)); hexa_Verts.Add(new Vector3(side, -side, side)); hexa_Verts.Add(new Vector3(side, side, side)); } public void Load_CubeOctahedron_List(float radius) { float r = (1 / Mathf.Sqrt(2)) * radius; Vector3 vUp = Vector3.up * 0.001f; cubeOct_Verts.Add(new Vector3(r, r, 0) + vUp); cubeOct_Verts.Add(new Vector3(0, r, r) + vUp); cubeOct_Verts.Add(new Vector3(0, r, -r) + vUp); cubeOct_Verts.Add(new Vector3(-r, r, 0) + vUp); cubeOct_Verts.Add(new Vector3(r, 0, -r) + vUp); cubeOct_Verts.Add(new Vector3(r, 0, r) + vUp); cubeOct_Verts.Add(new Vector3(-r, 0, -r) + vUp); cubeOct_Verts.Add(new Vector3(-r, 0, r) + vUp); cubeOct_Verts.Add(new Vector3(r, -r, 0) + vUp); cubeOct_Verts.Add(new Vector3(0, -r, r) + vUp); cubeOct_Verts.Add(new Vector3(0, -r, -r) + vUp); cubeOct_Verts.Add(new Vector3(-r, -r, 0) + vUp); cubeOct_Verts.Add(new Vector3(0, 0, 0) + vUp); //13 } public void Load_Icosahedron_List(float radius) { float magicAngle = Mathf.PI * 26.56505f / 180; float segmentAngle = Mathf.PI * 72 / 180; float currentAngle = 0f; for (var i = 0; i < 5; i++) { icosa_Verts.Add(PTUtils.PointOnSphere(radius, currentAngle, magicAngle)); currentAngle -= segmentAngle; } currentAngle = segmentAngle / 2; for (var i = 0; i < 5; i++) { icosa_Verts.Add(PTUtils.PointOnSphere(radius, currentAngle, -magicAngle)); currentAngle -= segmentAngle; } icosa_Verts.Add(new Vector3(0, -radius, 0)); icosa_Verts.Add(new Vector3(0, radius, 0)); } public Quaternion Get_Quat_from_Axis(int i) { float cos_axis = Vector3.Dot(Vector3.up, att_Params[i].vAxis); Vector3 axis_r = Vector3.Cross(Vector3.up, att_Params[i].vAxis); float sin_axis = Vector3.Magnitude(axis_r); axis_r.Normalize(); float theta = Mathf.Atan2(sin_axis,cos_axis); Quaternion q_Att = Quaternion.AngleAxis(theta * 180 / Mathf.PI, axis_r); Vector3 vXZ = att_Params[i].vAxis; vXZ.y = 0; vXZ.Normalize(); theta = Mathf.Atan2(vXZ.x, vXZ.z); Quaternion q_Axial = Quaternion.AngleAxis(theta * 180 / Mathf.PI, Vector3.up); return q_Att*q_Axial; } public Quaternion Get_Quat_from_Axis(Vector3 v) { float cos_axis = Vector3.Dot(Vector3.up, v); Vector3 axis_r = Vector3.Cross(Vector3.up, v); float sin_axis = Vector3.Magnitude(axis_r); axis_r.Normalize(); float theta = Mathf.Atan2(sin_axis, cos_axis); Quaternion q_Att = Quaternion.AngleAxis(theta * 180 / Mathf.PI, axis_r); Vector3 vXZ = v; vXZ.y = 0; vXZ.Normalize(); theta = Mathf.Atan2(vXZ.x, vXZ.z); Quaternion q_Axial = Quaternion.AngleAxis(theta * 180 / Mathf.PI, Vector3.up); return q_Att * q_Axial; } public void Set_Planet_Attractors() { //Reset_All_Attractors_From_Editor(); for (int i = 0; i < planets.Length; i++) { //ptp_GOs[i].transform.SetParent(planets[0].transform); ptp_GOs[i].transform.localPosition = planets[i].transform.position; ptp_GOs[i].transform.localRotation = Quaternion.identity; ptp_GOs[i].SetActive(true); } } public void Set_Tetra_Attractors() { int i; nAttractorCount = tetra_Verts.Count; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Quaternion q; for (i = 0; i < tetra_Verts.Count; i++) { //collector_BaseGO att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = tetra_Verts[i] * ui_Ladder.attractors_Position_Radius; att_Params[i].vAxis = tetra_Verts[i].normalized; q = Get_Quat_from_Axis(i); att_GOs[i].transform.localRotation = q; att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Octa_Attractors() { int i; nAttractorCount = octa_Verts.Count; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Quaternion q; for (i = 0; i < octa_Verts.Count; i++) { att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = octa_Verts[i] * ui_Ladder.attractors_Position_Radius; att_Params[i].vAxis = octa_Verts[i].normalized; q = Get_Quat_from_Axis(i); att_GOs[i].transform.localRotation = q; att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Hexa_Attractors() { int i; nAttractorCount = hexa_Verts.Count; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Quaternion q; for (i = 0; i < hexa_Verts.Count; i++) { //collector_BaseGO att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = hexa_Verts[i] * ui_Ladder.attractors_Position_Radius; att_Params[i].vAxis = hexa_Verts[i].normalized; q = Get_Quat_from_Axis(i); att_GOs[i].transform.localRotation = q; att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Merkaba_Attractors() { int i; nAttractorCount = merk_Verts.Count; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Quaternion q; for (i = 0; i < merk_Verts.Count; i++) { att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = merk_Verts[i] * ui_Ladder.attractors_Position_Radius; att_Params[i].vAxis = merk_Verts[i].normalized; q = Get_Quat_from_Axis(i); att_GOs[i].transform.localRotation = q; att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_CubeOct_Attractors() { int i; nAttractorCount = cubeOct_Verts.Count; //print("cube_Oct_Verts Count = " + nAttractorCount.ToString()); argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Quaternion q; for (i = 0; i < cubeOct_Verts.Count; i++) { att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = cubeOct_Verts[i] * ui_Ladder.attractors_Position_Radius; att_Params[i].vAxis = cubeOct_Verts[i].normalized; q = Get_Quat_from_Axis(i); att_GOs[i].transform.localRotation = q; att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Icosa_Attractors() { int i; nAttractorCount = icosa_Verts.Count; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Quaternion q; for (i = 0; i < icosa_Verts.Count; i++) { att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = icosa_Verts[i] * ui_Ladder.attractors_Position_Radius; att_Params[i].vAxis = icosa_Verts[i].normalized; q = Get_Quat_from_Axis(i); att_GOs[i].transform.localRotation = q; att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Dodec_Attractors() { int i; nAttractorCount = dodec_Verts.Count; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Quaternion q; for (i = 0; i < dodec_Verts.Count; i++) { att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = dodec_Verts[i] * ui_Ladder.attractors_Position_Radius; att_Params[i].vAxis = dodec_Verts[i].normalized; q = Get_Quat_from_Axis(i); att_GOs[i].transform.localRotation = q; att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Monad_Attractor() { nAttractorCount = 1; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Vector3 v = new Vector3(0, 12.00f, 0); att_GOs[0].transform.SetParent(collector_BaseGO.transform); att_GOs[0].transform.localPosition = v * ui_Ladder.attractors_Position_Radius; att_GOs[0].transform.localRotation = Quaternion.identity; att_GOs[0].SetActive(true); for (int j = 1; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Diad_Attractor() { nAttractorCount = 2; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Vector3 v1 = new Vector3(7.5f, 0, 0); Vector3 v2 = new Vector3(-7.5f, 0, 0); att_GOs[0].transform.SetParent(collector_BaseGO.transform); att_GOs[0].transform.localPosition = v1 * ui_Ladder.attractors_Position_Radius; att_GOs[0].transform.localRotation = Quaternion.LookRotation(v1); //att_GOs[0].transform.Rotate(Vector3.forward, 90); att_GOs[0].transform.localRotation = Quaternion.identity; att_GOs[0].SetActive(true); att_GOs[1].transform.SetParent(collector_BaseGO.transform); att_GOs[1].transform.localPosition = v2 * ui_Ladder.attractors_Position_Radius; att_GOs[1].transform.localRotation = Quaternion.LookRotation(v2); //att_GOs[1].transform.Rotate(Vector3.forward, -90); att_GOs[1].SetActive(true); for (int j = 2; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Triad_Attractor() { nAttractorCount = 3; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Vector3 v1 = triad_Verts[0]; Vector3 v2 = triad_Verts[1]; Vector3 v3 = triad_Verts[2]; att_GOs[0].transform.SetParent(collector_BaseGO.transform); att_GOs[0].transform.localPosition = v1 * ui_Ladder.attractors_Position_Radius; att_GOs[0].transform.localRotation = Quaternion.LookRotation(v1); att_GOs[0].transform.Rotate(Vector3.right, 90); att_GOs[0].SetActive(true); att_GOs[1].transform.SetParent(collector_BaseGO.transform); att_GOs[1].transform.localPosition = v2 * ui_Ladder.attractors_Position_Radius; att_GOs[1].transform.localRotation = Quaternion.LookRotation(v2); att_GOs[1].transform.Rotate(Vector3.right, 90); att_GOs[1].SetActive(true); att_GOs[2].transform.SetParent(collector_BaseGO.transform); att_GOs[2].transform.localPosition = v3 * ui_Ladder.attractors_Position_Radius; att_GOs[2].transform.localRotation = Quaternion.LookRotation(v3); att_GOs[2].transform.Rotate(Vector3.right, 90); att_GOs[2].SetActive(true); for (int j = 3; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Five_Attractors() { int i; nAttractorCount = 5; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Quaternion q; for (i = 0; i < 5; i++) { att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = five_Verts[i] * ui_Ladder.attractors_Position_Radius; att_GOs[i].transform.localRotation = Quaternion.LookRotation(five_Verts[i]); att_GOs[i].transform.Rotate(Vector3.right, 90); att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void Set_Seven_Attractors() { int i; nAttractorCount = 7; argos_Particle_Spawner.SetAttractorCount(nAttractorCount); Quaternion q; for (i = 0; i < 7; i++) { att_GOs[i].transform.SetParent(collector_BaseGO.transform); att_GOs[i].transform.localPosition = seven_Verts[i] * ui_Ladder.attractors_Position_Radius; //att_Params[i].vAxis = five_Verts[i].normalized; if (i == 0) { att_GOs[i].transform.localRotation = Quaternion.identity; } else { q = Quaternion.LookRotation(seven_Verts[i]); att_GOs[i].transform.localRotation = q; att_GOs[i].transform.Rotate(Vector3.right, 90); } att_GOs[i].SetActive(true); } for (int j = i; j < att_GOs.Length; j++) { att_GOs[j].SetActive(false); } } public void getAttractors(ref GameObject[] goATT, ref Att_Params[] attParams, ref int nCount)//UPDATE { nCount = nAttractorCount; for (int i = 0; i < 20; i++) { goATT[i] = att_GOs[i]; attParams[i] = att_Params[i]; } } //public void injectAttractors_From_UI_Spheres(ref List<Vector3> vLst)//CHECK WITH RB.POSTION //{ // //int i; // //nAttractorCount = vLst.Count; // //argos_Particle_Spawner.SetAttractorCount(nAttractorCount); // ////print(nAttractorCount.ToString()); // //for (i = 0; i<vLst.Count; i++) // //{ // // //collector_BaseGO // // att_GOs[i].transform.SetParent(collector_BaseGO.transform); // // att_GOs[i].transform.localPosition = vLst[i]; // // att_GOs[i].SetActive(true); // //} // //for(int j = i; j<att_GOs.Length; j++) // //{ // // att_GOs[j].SetActive(false); // //} //} //private void DoGripPressed(object sender, ControllerInteractionEventArgs e) //{ // ui_On = !ui_On; // animator.SetBool("UI_On", ui_On); // if (ui_On && hmdTrackedObject) // { // Vector3 fwd = hmdTrackedObject.transform.forward; // fwd.y = 0f; // fwd.Normalize(); // Quaternion q = Quaternion.LookRotation(fwd, Vector3.up); // ui_BaseTransform.rotation = q; // ui_BaseTransform.transform.position = hmdTrackedObject.transform.position + fwd * uiDist; // } // DebugLogger(e.controllerIndex, "TOUCHPAD", "pressed down", e); //} public Vector3 getVec(SerialVect3 sv3) { Vector3 v = new Vector3(); v.x = sv3._vx; v.y = sv3._vy; v.z = sv3._vz; return v; } //FOR PAINTING AND SERIALIZATION //public void Test_Instantiate() //{ // for (int i = 0; i < equiDist_Base_SV3.Count; i++) // { // equiDist_Base_Vect3.Add(getVec(equiDist_Base_SV3[i])); // } // int interval = 2; // GameObject go = null; // for (int j = 0; j < equiDist_Base_Vect3.Count; j++) // { // if (j % interval == 0) // go = (GameObject)Instantiate(prefab_to_Instance, equiDist_Base_Vect3[j], Quaternion.identity); // go.GetComponent<VRTK_Object_PlayNote>().SetText(j); // } //} public void onQuadDistSlideChanged() { rQuadDist = slideQuadDist.value; } public void onQCamDistSlideChanged() { rCamDist = slideCamDist.value; } public void onUIDistSlideChanged() { uiDist = slideUIDist.value; } public Transform get_Head_Transform() { return hmdTrackedObject.transform; } public float Euler_Mirroring(float w) { if (w > 170f && w < 180f) w = 170f; if (w < 190f && w > 180f) w = 190f; if (w < 180f)//60 range { w = -(w); } else { w = (360f - w); } return w; } private Vector3 slerp_Ctrl_Pos_1; private Quaternion slerp_Rotation_1; private Vector3 slerp_Ctrl_Pos_2; private Quaternion slerp_Rotation_2; public float grab_Rotate_Damping = 1.61803f; private void CLIMBING_IN_The_VU() { //Vector3 vCtrl1_to_Ctrl2 = ctrl2.transform.position - ctrl1.transform.position; bool bClimb1 = ctrl1.GetComponent<Argos_Controller_Interface>().bClimbing; bool bClimb2 = ctrl2.GetComponent<Argos_Controller_Interface>().bClimbing; Vector3 axis; float angle; if (bClimb1 || bClimb2) { if (is_A_Trigger_Pressed() && bClimb1) { //print("Climb Frame Trigger & bClimb - 1"); vCtrl1_Right = ctrl1.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl1_Right, vCtrl1_Last_Right); vCtrl1_Up = ctrl1.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl1_Up, vCtrl1_Last_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_1 = Vector3.Slerp(slerp_Ctrl_Pos_1, ctrl1.transform.position, Time.deltaTime * grab_Rotate_Damping); slerp_Rotation_1 = Quaternion.Slerp(slerp_Rotation_1, q3, Time.deltaTime * grab_Rotate_Damping); slerp_Rotation_1.ToAngleAxis(out angle, out axis); argos_Teleport.transform.RotateAround(ctrl1.transform.position, axis, angle * 0.99f); //VU_UI.transform.RotateAround(ctrl1.transform.position, axis, angle * 0.99f); } else if (is_A_Trigger_Pressed() && bClimb2) { //print("Climb Frame Trigger & bClimb - 2"); vCtrl2_Right = ctrl2.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl2_Right, vCtrl2_Last_Right); vCtrl2_Up = ctrl2.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl2_Up, vCtrl2_Last_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_2 = Vector3.Slerp(slerp_Ctrl_Pos_2, ctrl2.transform.position, Time.deltaTime * grab_Rotate_Damping); slerp_Rotation_2 = Quaternion.Slerp(slerp_Rotation_2, q3, Time.deltaTime * grab_Rotate_Damping); slerp_Rotation_2.ToAngleAxis(out angle, out axis); argos_Teleport.transform.RotateAround(ctrl2.transform.position, axis, angle * 0.99f); //VU_UI.transform.RotateAround(ctrl2.transform.position, axis, angle * 0.99f); } if (!is_A_Trigger_Pressed()) { float c = 1; if (current_USER_LOCATION == USER_LOCATION.IN_THE_VU) { c = curr_Flight_Velocity; } if (bClimb1) { //print("Climb Frame GRIP & bClimb - 1"); Vector3 vDelt = ctrl1.transform.position - vCtrl1_Last_Pos; Vector3 vTran = c * vDelt; //argos_Teleport.transform.InverseTransformDirection(c * vDelt); argos_Teleport.transform.position -= vTran; //VU_UI.transform.position -= vTran; } else if (bClimb2) { //print("Climb Frame GRIP & bClimb - 2"); Vector3 vDelt = ctrl2.transform.position - vCtrl2_Last_Pos; Vector3 vTran = c * vDelt; //argos_Teleport.transform.InverseTransformDirection(c *vDelt); argos_Teleport.transform.position -= vTran; //VU_UI.transform.position -= vTran; } if (active_Ctrl_States.bCtrl_1_On) { //slerp_Ctrl_Pos_1 = ctrl1.transform.position; //slerp_Rotation_1 = Quaternion.identity; vCtrl1_Right = ctrl1.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl1_Right, vCtrl1_Right); vCtrl1_Up = ctrl1.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl1_Up, vCtrl1_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_1 = ctrl1.transform.position; slerp_Rotation_1 = q3; } if (active_Ctrl_States.bCtrl_2_On) { //slerp_Ctrl_Pos_2 = ctrl2.transform.position; //slerp_Rotation_2 = Quaternion.identity; vCtrl2_Right = ctrl2.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl2_Right, vCtrl2_Right); vCtrl2_Up = ctrl2.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl2_Up, vCtrl2_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_2 = ctrl2.transform.position; slerp_Rotation_2 = q3; } } } else { if (active_Ctrl_States.bCtrl_1_On) { //slerp_Ctrl_Pos_1 = ctrl1.transform.position; //slerp_Rotation_1 = Quaternion.identity; vCtrl1_Right = ctrl1.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl1_Right, vCtrl1_Right); vCtrl1_Up = ctrl1.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl1_Up, vCtrl1_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_1 = ctrl1.transform.position; slerp_Rotation_1 = q3; } if (active_Ctrl_States.bCtrl_2_On) { //slerp_Ctrl_Pos_2 = ctrl2.transform.position; //slerp_Rotation_2 = Quaternion.identity; vCtrl2_Right = ctrl2.transform.right; Quaternion q = Quaternion.FromToRotation(vCtrl2_Right, vCtrl2_Right); vCtrl2_Up = ctrl2.transform.up; Quaternion q2 = Quaternion.FromToRotation(vCtrl2_Up, vCtrl2_Up); Quaternion q3 = q * q2; slerp_Ctrl_Pos_2 = ctrl1.transform.position; slerp_Rotation_2 = q3; } } vCtrl1_Last_Right = ctrl1.transform.right; vCtrl2_Last_Right = ctrl2.transform.right; vCtrl1_Last_Up = ctrl1.transform.up; vCtrl2_Last_Up = ctrl2.transform.up; vCtrl1_Last_Pos = ctrl1.transform.position; vCtrl2_Last_Pos = ctrl2.transform.position; } //Vector3 vLastPos; //Vector3 vCurrPos; //Vector3 vCtrl_Right; //Vector3 vCtrl_Up; //Vector3 vCtrl_Last_Right; //Vector3 vCtrl_Last_Up; //Vector3 slerp_Ctrl_Pos; //Quaternion slerp_Rotation; //public float flight_Rotate_Damping = 1.61803f; //public void Shape_Flight_Control_Transforms() //{ // if (glass_Stabilizer != null) // { // vCurrPos = argos_Teleport.transform.position; // if (active_Ctrl_States.bGlobal_Flight_Control_On) // { // GameObject ctrl; // if (active_Ctrl_States.bFlight_1_On) // { // ctrl = ctrl1; // } // else // { // ctrl = ctrl2; // } // if (!bUI_Grabbed_Glass_Hold) // { // Vector3 axis; // float angle; // float rotation_Rate = argos_file.Get_Curr_Rotation_Rate_Adjust((int)active_Ctrl_States.curr_FLIGHT_MODE); //ui_Ladder.Rotation_Rate; // float velocity_Adjust = argos_file.Get_Curr_Velocity_Adjust((int)active_Ctrl_States.curr_FLIGHT_MODE);//ui_Ladder.Velocity_Adjust; // if (current_USER_LOCATION != USER_LOCATION.IN_THE_VU) // { // rotation_Rate /= 5f; //Don't rotate so much in Lab View // velocity_Adjust = velocity_Adjust * 5; // } // vCtrl_Right = ctrl.transform.right; // Quaternion q = Quaternion.FromToRotation(vCtrl_Last_Right,vCtrl_Right ); // vCtrl_Up = ctrl.transform.up; // Quaternion q2 = Quaternion.FromToRotation(vCtrl_Last_Up, vCtrl_Up); // Quaternion q3 = q * q2; // slerp_Ctrl_Pos = Vector3.Slerp(slerp_Ctrl_Pos, ctrl.transform.position, Time.deltaTime * rotation_Rate); // slerp_Rotation = Quaternion.Slerp(slerp_Rotation, q3, Time.deltaTime * rotation_Rate); // slerp_Rotation.ToAngleAxis(out angle, out axis); // argos_Teleport.transform.RotateAround(slerp_Ctrl_Pos, axis, angle * 0.99f); // VU_UI.transform.RotateAround(slerp_Ctrl_Pos, axis, angle * 0.99f); // Vector3 dP = glass_Stabilizer.get_current_Velocity() * velocity_Adjust * Time.fixedDeltaTime; // argos_Teleport.transform.position += dP; // VU_UI.transform.transform.position += dP; // } // else // { // slerp_Ctrl_Pos = ctrl1.transform.position; // slerp_Rotation = Quaternion.identity; // } // vCtrl_Last_Right = ctrl.transform.right; // vCtrl_Last_Up = ctrl.transform.up; // } // else // { // vCtrl_Last_Right = Get_Most_Recent_Interacting_Controller().transform.right; // vCtrl_Last_Up = Get_Most_Recent_Interacting_Controller().transform.up; // } // vLastPos = vCurrPos; // } //} /// <summary> /// ORIGINAL Shape_Flight_Control_Transforms() /// </summary> /// <returns></returns> Vector3 vLastPos; Vector3 vCurrPos; Vector3 vDelt; Vector3 velocity = Vector3.zero; Vector3[] velocitySumDamp = new Vector3[10]; int last_I; float val_Z_last; float val_X_last; float val_Y_last; bool bGripPressed_Last = false; private bool Is_A_GripPressed_Shape_Flight() { bool bGRIP1 = false; bool bGRIP2 = false; if (active_Ctrl_States.bCtrl_1_On) { bGRIP1 = ctrl1.GetComponent<Argos_Controller_Interface>().bClimbing; } if(active_Ctrl_States.bCtrl_2_On) { bGRIP2 = ctrl2.GetComponent<Argos_Controller_Interface>().bClimbing; } bool bA_Grip_Is_Pressed = bGRIP1 || bGRIP2; if(!bA_Grip_Is_Pressed && bGripPressed_Last) { ctrl_Rotation.Init_Rotations(); glass_Stabilizer.Init_Flight(); } bGripPressed_Last = bA_Grip_Is_Pressed; return bA_Grip_Is_Pressed; } public void SetFlight_Rates() { curr_Flight_Rotation_Rate = argos_file.Get_Curr_Rotation_Rate_Adjust((int)active_Ctrl_States.curr_FLIGHT_MODE); curr_Flight_Velocity = argos_file.Get_Curr_Velocity_Adjust((int)active_Ctrl_States.curr_FLIGHT_MODE); } public void Shape_Flight_Control_Transforms() { if (glass_Stabilizer != null) { vCurrPos = argos_Teleport.transform.position; if (active_Ctrl_States.bGlobal_Flight_Control_On) { if (!bUI_Grabbed_Glass_Hold && !Is_A_GripPressed_Shape_Flight()) { float rotation_Rate = curr_Flight_Rotation_Rate; float velocity_Adjust = curr_Flight_Velocity; if (current_USER_LOCATION == USER_LOCATION.IN_THE_VU) { rotation_Rate *= 1.61803f; //Don't rotate so much in Lab View velocity_Adjust = velocity_Adjust /3; } float val_X = ctrl_Rotation.get_x_Rota(); float val_Y = ctrl_Rotation.get_y_Rota(); float val_Z = ctrl_Rotation.get_z_Rota(); Quaternion q = Quaternion.Euler(-rotation_Rate * val_X * Time.fixedDeltaTime, -rotation_Rate * val_Y * Time.fixedDeltaTime, -rotation_Rate * val_Z * Time.fixedDeltaTime); GameObject goCtrl = glass_Stabilizer.gameObject.GetComponentInParent<Argos_Controller_Interface>().gameObject; Quaternion qCtrlnew = goCtrl.transform.rotation * q; Quaternion diffQ = goCtrl.transform.rotation * Quaternion.Inverse(qCtrlnew); float angle; Vector3 axis; diffQ.ToAngleAxis(out angle, out axis); argos_Teleport.transform.RotateAround(glass_Stabilizer.gameObject.transform.position, axis, angle); //argos_Teleport.transform.RotateAround(glass_Stabilizer.gameObject.transform.position, // glass_Stabilizer.gameObject.transform.forward, rotation_Rate * val_Z * Time.fixedDeltaTime); //VU_UI.transform.RotateAround(glass_Stabilizer.gameObject.transform.position, // glass_Stabilizer.gameObject.transform.forward, rotation_Rate * val_Z * Time.fixedDeltaTime); ///////////////////////////////// //argos_Teleport.transform.RotateAround(glass_Stabilizer.gameObject.transform.position, // glass_Stabilizer.gameObject.transform.right, rotation_Rate * val_X * Time.fixedDeltaTime); //VU_UI.transform.RotateAround(glass_Stabilizer.gameObject.transform.position, // glass_Stabilizer.gameObject.transform.right, rotation_Rate * val_X * Time.fixedDeltaTime); ///////////////////////////////// //argos_Teleport.transform.RotateAround(glass_Stabilizer.gameObject.transform.position, // glass_Stabilizer.gameObject.transform.up, rotation_Rate * val_Y * Time.fixedDeltaTime); //VU_UI.transform.RotateAround(glass_Stabilizer.gameObject.transform.position, // glass_Stabilizer.gameObject.transform.up, rotation_Rate * val_Y * Time.fixedDeltaTime); ///////////////////////////////// Vector3 dP = glass_Stabilizer.get_current_Velocity() * velocity_Adjust * Time.fixedDeltaTime; argos_Teleport.transform.position += dP; //VU_UI.transform.transform.position += dP; } } vLastPos = vCurrPos; } } public Argos_Teleport getArgos_Teleport() { return argos_Teleport; } //int count = 0; //float last_dy = 0; //int upcount = 0; //int downcount = 0; //public void Controller_Gesture_Recognition() //{ // //private float[] recognition_Buffer_1 = new float[100];//delta Ys // //private float[] recognition_Buffer_2 = new float[100]; // //private Vector3 vLast_Ctrl_1_Pos; // //private Vector3 vLast_Ctrl_2_Pos; // //private int iCurrIdx = 0; // float dy = 0; // if (isCtrl_1_Active()) // { // dy = ctrl1.transform.position.y - vLast_Ctrl_1_Pos.y; // if(dy>last_dy) // { // upcount++; // if (upcount > 5) // { // if (dy > 0.8f) // { // print("caught Flick Up"); // upcount = 0; // } // } // } // else // { // upcount = 0; // } // if (dy < last_dy) // { // downcount++; // if (downcount > 5) // { // if (dy < -0.8f) // { // print("caught Flick Down"); // downcount = 0; // } // } // } // else // { // downcount = 0; // } // if (++count < 2000) // { // sWrite.WriteLine(dy.ToString("F3")); // } // else // { // sWrite.Close(); // } // } // vLast_Ctrl_1_Pos = ctrl1.transform.position; // last_dy = dy; // //if (++iCurrIdx > 99) iCurrIdx = 0; // //recognition_Buffer_1[iCurrIdx] = ctrl1.transform.position.y - vLast_Ctrl_1_Pos.y; // //int i = iCurrIdx; // //float sum = 0f; // //while(i>-1) // //{ // // sum += recognition_Buffer_1[i]; // //} //} //public void Set_Linear_Control_to_Controller(ControllerInteractionEventArgs e, bool bOn) //{ // if (bOn) // { // uint controllerIndex = VRTK_DeviceFinder.GetControllerIndex(ctrl1); // //if (controllerIndex == e.controllerIndex) // //{ // // glass_Stabilizer = ctrl1.GetComponentInChildren<Glass_Stabilizer>(); // // argos_Controller_Interface_1.Show_Glass_Navigator(true); // // if (argos_Controller_Interface_2 != null) // // { // // argos_Controller_Interface_2.Show_Glass_Navigator(false); // // } // // ctrl_Rotation = ctrl_1_Rotations; // //} // //else // //{ // // glass_Stabilizer = ctrl2.GetComponentInChildren<Glass_Stabilizer>(); // // glass_Stabilizer.Set_OK_TO_PROCESS(true); // // argos_Controller_Interface_2.Show_Glass_Navigator(true); // // if (argos_Controller_Interface_1 != null) // // { // // argos_Controller_Interface_1.Show_Glass_Navigator(false); // // } // // ctrl_Rotation = ctrl_2_Rotations; // //} // } // else // { // //if (glass_Stabilizer != null) // //{ // // glass_Stabilizer.Set_OK_TO_PROCESS(false); // // glass_Stabilizer = null; // // if (argos_Controller_Interface_1 != null) // // { // // argos_Controller_Interface_1.Show_Glass_Navigator(false); // // } // // if (argos_Controller_Interface_2 != null) // // { // // argos_Controller_Interface_2.Show_Glass_Navigator(false); // // } // //} // } //} public void Flight_Controller_Assignment_And_Switch(GameObject ctrl) { if(ctrl == ctrl1) { ctrl_Rotation = ctrl_1_Rotations; if (active_Ctrl_States.bCtrl_2_On) { ctrl2.GetComponent<Argos_Controller_Interface>().Show_Glass_Navigator(false); } } else { ctrl_Rotation = ctrl_2_Rotations; if (active_Ctrl_States.bCtrl_1_On) { ctrl1.GetComponent<Argos_Controller_Interface>().Show_Glass_Navigator(false); } } ctrl_Rotation.Init_Rotations(); } public void Set_Flight_Control_to_Controller(GameObject ctrl, bool bOn) { if (bOn) { glass_Stabilizer = ctrl.GetComponentInChildren<Glass_Stabilizer>(); glass_Stabilizer.Set_Flight_Mode(active_Ctrl_States.curr_FLIGHT_MODE); ctrl.GetComponent<Argos_Controller_Interface>().Show_Glass_Navigator(true); glass_Stabilizer.Set_OK_TO_PROCESS(true); Set_Most_Recent_Interacting_Controller(ctrl); Flight_Controller_Assignment_And_Switch(ctrl); } else { glass_Stabilizer.Set_OK_TO_PROCESS(false); ctrl.GetComponent<Argos_Controller_Interface>().Show_Glass_Navigator(false); } } public void Set_Current_Flight_Mode(int fmode) { active_Ctrl_States.curr_FLIGHT_MODE = fmode; SetFlight_Rates(); } public void Set_Current_Flight_Mode_Serialize_UI_Butt(int fmode) { active_Ctrl_States.curr_FLIGHT_MODE = fmode; if (glass_Stabilizer != null) { glass_Stabilizer.Set_Flight_Mode(active_Ctrl_States.curr_FLIGHT_MODE); } } //public void Set_Flight_Control(GameObject ctrl, bool bOn) //{ // if (bOn) // { // if (ctrl == ctrl1) // { // glass_Stabilizer = ctrl1.GetComponentInChildren<Glass_Stabilizer>(); // glass_Stabilizer.Set_OK_TO_PROCESS(true); // glass_Stabilizer.Set_Flight_Mode(active_Ctrl_States.curr_FLIGHT_MODE); // argos_Controller_Interface_1.Show_Glass_Navigator(true); // if (argos_Controller_Interface_2 != null) // { // argos_Controller_Interface_2.Show_Glass_Navigator(false); // } // ctrl_Rotation = ctrl_1_Rotations; // } // else // { // glass_Stabilizer = ctrl2.GetComponentInChildren<Glass_Stabilizer>(); // glass_Stabilizer.Set_OK_TO_PROCESS(true); // glass_Stabilizer.Set_Flight_Mode(active_Ctrl_States.curr_FLIGHT_MODE); // argos_Controller_Interface_2.Show_Glass_Navigator(true); // if (argos_Controller_Interface_1 != null) // { // argos_Controller_Interface_1.Show_Glass_Navigator(false); // } // ctrl_Rotation = ctrl_2_Rotations; // } // } // else // { // if (glass_Stabilizer != null) // { // glass_Stabilizer.Set_OK_TO_PROCESS(false); // glass_Stabilizer = null; // if (argos_Controller_Interface_1 != null) // { // argos_Controller_Interface_1.Show_Glass_Navigator(false); // } // if (argos_Controller_Interface_2 != null) // { // argos_Controller_Interface_2.Show_Glass_Navigator(false); // } // } // } //} public void Set_Controller_State(Controller_State_Indicator.State state) { controller_State_Indicator.Set_State(state); } public void reset_UI_Pointers_For_the_VU() { if(bBoth_Ctrl_On) { //ctrl1.GetComponent<VRTK_UIPointer>().Reset(); //ctrl2.GetComponent<VRTK_UIPointer>().Reset(); } } public bool Is_A_Fine_Tuner_On() { return active_Ctrl_States.bFineTune_1_On || active_Ctrl_States.bFineTune_2_On; } private void Enable_HMD_Ctrl_1() { ctrl1.GetComponent<VRTK_ControllerEvents>().TriggerPressed += new ControllerInteractionEventHandler(DoTriggerPressed); ctrl1.GetComponent<VRTK_ControllerEvents>().TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased); ctrl1.GetComponent<VRTK_ControllerEvents>().TouchpadPressed += new ControllerInteractionEventHandler(DoTouchpadPressed); ctrl1.GetComponent<VRTK_ControllerEvents>().TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased); ctrl1.GetComponent<VRTK_ControllerEvents>().TouchpadTouchStart += new ControllerInteractionEventHandler(DoTouchpadTouchStart); ctrl1.GetComponent<VRTK_ControllerEvents>().TouchpadTouchEnd += new ControllerInteractionEventHandler(DoTouchpadTouchEnd); } private void Enable_HMD_Ctrl_2() { ctrl2.GetComponent<VRTK_ControllerEvents>().TriggerPressed += new ControllerInteractionEventHandler(DoTriggerPressed); ctrl2.GetComponent<VRTK_ControllerEvents>().TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased); ctrl2.GetComponent<VRTK_ControllerEvents>().TouchpadPressed += new ControllerInteractionEventHandler(DoTouchpadPressed); ctrl2.GetComponent<VRTK_ControllerEvents>().TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased); ctrl2.GetComponent<VRTK_ControllerEvents>().TouchpadTouchStart += new ControllerInteractionEventHandler(DoTouchpadTouchStart); ctrl2.GetComponent<VRTK_ControllerEvents>().TouchpadTouchEnd += new ControllerInteractionEventHandler(DoTouchpadTouchEnd); } private void Disable_HMD_Ctrl_1() { ctrl1.GetComponent<VRTK_ControllerEvents>().TriggerPressed -= new ControllerInteractionEventHandler(DoTriggerPressed); ctrl1.GetComponent<VRTK_ControllerEvents>().TriggerReleased -= new ControllerInteractionEventHandler(DoTriggerReleased); ctrl1.GetComponent<VRTK_ControllerEvents>().TouchpadPressed -= new ControllerInteractionEventHandler(DoTouchpadPressed); ctrl1.GetComponent<VRTK_ControllerEvents>().TouchpadReleased -= new ControllerInteractionEventHandler(DoTouchpadReleased); ctrl1.GetComponent<VRTK_ControllerEvents>().TouchpadTouchStart -= new ControllerInteractionEventHandler(DoTouchpadTouchStart); ctrl1.GetComponent<VRTK_ControllerEvents>().TouchpadTouchEnd -= new ControllerInteractionEventHandler(DoTouchpadTouchEnd); } private void Disable_HMD_Ctrl_2() { ctrl2.GetComponent<VRTK_ControllerEvents>().TriggerPressed -= new ControllerInteractionEventHandler(DoTriggerPressed); ctrl2.GetComponent<VRTK_ControllerEvents>().TriggerReleased -= new ControllerInteractionEventHandler(DoTriggerReleased); ctrl2.GetComponent<VRTK_ControllerEvents>().TouchpadPressed -= new ControllerInteractionEventHandler(DoTouchpadPressed); ctrl2.GetComponent<VRTK_ControllerEvents>().TouchpadReleased -= new ControllerInteractionEventHandler(DoTouchpadReleased); ctrl2.GetComponent<VRTK_ControllerEvents>().TouchpadTouchStart -= new ControllerInteractionEventHandler(DoTouchpadTouchStart); ctrl2.GetComponent<VRTK_ControllerEvents>().TouchpadTouchEnd -= new ControllerInteractionEventHandler(DoTouchpadTouchEnd); } public void Poll_Controllers_and_Use_Mode() { //Create Event if(isCtrl_1_Active() && isCtrl_2_Active()) { if (!bBoth_Ctrl_On) { //OnBothCtrl_On(); //menuSelectorMover.onControllers_Active(); bBoth_Ctrl_On = true; } } else { if(bBoth_Ctrl_On) { //OnBothCtrl_NOT_On(); bBoth_Ctrl_On = false; } } active_Ctrl_States.bCtrl_1_On = false; active_Ctrl_States.bStylus_1_Extended = false; active_Ctrl_States.bStylus_1_Editing = false; active_Ctrl_States.bFineTune_1_On = false; active_Ctrl_States.bFlight_1_On = false; active_Ctrl_States.bCtrl_2_On = false; active_Ctrl_States.bStylus_2_Extended = false; active_Ctrl_States.bStylus_2_Editing = false; active_Ctrl_States.bFineTune_2_On = false; active_Ctrl_States.bFlight_2_On = false; if (ctrl1_Tracked_Base.activeSelf) { //if(!active_Ctrl_States.bCtrl_1_On) //{ // Enable_HMD_Ctrl_1(); //} active_Ctrl_States.bCtrl_1_On = true; if (argos_Controller_Interface_1 == null) { argos_Controller_Interface_1 = ctrl1.GetComponent<Argos_Controller_Interface>(); } if (argos_Controller_Interface_1.bStylus_Extended) active_Ctrl_States.bStylus_1_Extended = true; if (argos_Controller_Interface_1.bStylus_Editing) active_Ctrl_States.bStylus_1_Editing = true; if (argos_Controller_Interface_1.bFineTuner_On) active_Ctrl_States.bFineTune_1_On = true; if (argos_Controller_Interface_1.bFlight_On) active_Ctrl_States.bFlight_1_On = true; } if (ctrl2_Tracked_Base.activeSelf) { //if (!active_Ctrl_States.bCtrl_2_On) //{ // Enable_HMD_Ctrl_2(); //} active_Ctrl_States.bCtrl_2_On = true; if (argos_Controller_Interface_2 == null) { argos_Controller_Interface_2 = ctrl2.GetComponent<Argos_Controller_Interface>(); } if (argos_Controller_Interface_2.bStylus_Extended) active_Ctrl_States.bStylus_2_Extended = true; if (argos_Controller_Interface_2.bStylus_Editing) active_Ctrl_States.bStylus_2_Editing = true; if (argos_Controller_Interface_2.bFineTuner_On) active_Ctrl_States.bFineTune_2_On = true; if (argos_Controller_Interface_2.bFlight_On) active_Ctrl_States.bFlight_2_On = true; } if (active_Ctrl_States.bFlight_1_On || active_Ctrl_States.bFlight_2_On) { active_Ctrl_States.bGlobal_Flight_Control_On = true; } else if (active_Ctrl_States.bGlobal_Flight_Control_On) { active_Ctrl_States.bGlobal_Flight_Control_On = false; } } public void Set_Both_Flight_Buttons(bool bOn) { if (active_Ctrl_States.bCtrl_1_On && active_Ctrl_States.bCtrl_2_On) { if (bOn) { // if (!argosRadialMenuController_1.bFlight_On) // argosRadialMenuController_1.SetFlightButtonOn(true); // if (!argosRadialMenuController_2.bFlight_On) // argosRadialMenuController_2.SetFlightButtonOn(true); //} //else //{ // if (argosRadialMenuController_1.bFlight_On) // argosRadialMenuController_1.SetFlightButtonOn(false); // if (argosRadialMenuController_2.bFlight_On) // argosRadialMenuController_2.SetFlightButtonOn(false); } } } public void SetUseMode(USE_MODE useMode)//TRIGGER EVENT { use_MODE = useMode; if (useMode != use_MODE_Last) { Use_Mode_Change(useMode);//THIS IS THE EVENT !!! } use_MODE_Last = use_MODE; } public float Get_World_Scale() { return active_Ctrl_States.world_Scale; } public bool is_A_Trigger_Pressed() { return active_Ctrl_States.bTrigger_1_Pressed || active_Ctrl_States.bTrigger_2_Pressed; } public bool is_A_TouchPad_Pressed() { return active_Ctrl_States.bTouchpad_1_Pressed || active_Ctrl_States.bTouchpad_2_Pressed; } public bool Both_Controllers_Are_On() { return active_Ctrl_States.bCtrl_1_On && active_Ctrl_States.bCtrl_2_On; } public void Toggle_Stylus() { Argos_Controller_Interface aci = most_Recent_Interacting_Controller.GetComponent<Argos_Controller_Interface>(); if(stylus_Tog_BV.isON) { aci.Show_Stylus(true); } else { aci.Show_Stylus(false); } } public bool isCtrl_1_Active() { return active_Ctrl_States.bCtrl_1_On; } public bool isCtrl_2_Active() { return active_Ctrl_States.bCtrl_2_On; } public bool isStylus_1_Extended() { return active_Ctrl_States.bStylus_1_Extended; } public bool isStylus_2_Extended() { return active_Ctrl_States.bStylus_2_Extended; } public bool isStylus_1_Editing() { return active_Ctrl_States.bStylus_1_Editing; } public bool isStylus_2_Editing() { return active_Ctrl_States.bStylus_2_Editing; } public List<float> get_Stylus_1_Radii() { return ctrl1.GetComponent<Argos_Controller_Interface>().GetComponentInChildren<Stylus>().fRadii_Out; } public List<float> get_Stylus_2_Radii() { return ctrl2.GetComponent<Argos_Controller_Interface>().GetComponentInChildren<Stylus>().fRadii_Out; } public Vector3[] get_Stylus_1_Positions() { return ctrl1.GetComponent<Argos_Controller_Interface>().GetComponentInChildren<Stylus>().getBrushElement_Positions(); } public Vector3[] get_Stylus_2_Positions() { return ctrl2.GetComponent<Argos_Controller_Interface>().GetComponentInChildren<Stylus>().getBrushElement_Positions(); } public Vector3 World_Space_To_Head_Directions(Vector3 v) { Vector3 vOut = new Vector3(); vOut.z = Vector3.Dot(hmdTrackedObject.transform.forward, v); vOut.y = Vector3.Dot(hmdTrackedObject.transform.up, v); vOut.x = Vector3.Dot(hmdTrackedObject.transform.right, v); //print("HeadSpace Vec" + vOut.ToString("F2")); return vOut; } public Vector3 Position_From_Head_Rel_VU_UI(Vector3 v) { float scale = Get_World_Scale(); return hmdTrackedObject.transform.position + v.z * hmdTrackedObject.transform.forward * scale + v.y * hmdTrackedObject.transform.up * scale + v.x * hmdTrackedObject.transform.right * scale; } public Vector3 Position_From_Head_Rel_VU_UI_Tweening(Vector3 v, float worldScale) { //Vector3 vN = v.normalized; //float mag = v.magnitude; //if (mag > 42) //{ // v = vN * 42f; //} //if (mag < 38) //{ // v = vN * 38f; //} return hmdTrackedObject.transform.position + v.z * hmdTrackedObject.transform.forward * worldScale + v.y * hmdTrackedObject.transform.up * worldScale + v.x * hmdTrackedObject.transform.right * worldScale; } private void Blink_Adjust_All_Attractors_Indicator() { if (bAdjust_All_Attractors) { Color col; col = adjust_All_Image.color; float blink = 0.5f * (1 + Mathf.Sin(Time.time * (2 * Mathf.PI))); col = new Color(blink, 1 - blink, 1, 1); adjust_All_Image.color = col; } else { adjust_All_Image.color = new Color(1, 1, 1, 1); } } private void UI_Animations() { Blink_Adjust_All_Attractors_Indicator(); } public void UpRight_Teleport_Lobby(bool bUpdateUI) { if (current_USER_LOCATION == USER_LOCATION.LOBBY) { Set_Miniature_Mode(false); //VU_UI.Editing(); Vector3 vLookAt = start_Lobby_LOOK_AT_GO.transform.position; Vector3 vTarget = start_Lobby_HEAD_POSITION.transform.position; argos_Teleport.OnRight_Lobby_Lookat_Guided_Handle(vTarget, vLookAt, bUpdateUI); } } //private IEnumerator Wait_Present_VU_UI(float time) //{ // yield return new WaitForSeconds(time); // VU_UI.Present_VU_UI(); //} float lobbyTimer = 5; private void LOBBY_CAMERA_UP() { if (VU_UI.Is_Done_Editing()) { lobbyTimer += Time.deltaTime; if (lobbyTimer > 5) { UpRight_Teleport_Lobby(false); lobbyTimer = 0; } } } void FixedUpdate() { if (active_Ctrl_States.bTHE_VU_is_RUNNING) { Shape_Flight_Control_Transforms(); Poll_Controllers_and_Use_Mode(); UI_Animations(); CLIMBING_IN_The_VU(); if (current_USER_LOCATION == USER_LOCATION.LOBBY && !argos_Teleport.bTeleporting_Now) { //LOBBY_CAMERA_UP(); } } //Are_We_Live(); Yes if (hmdTrackedObject == null) { SteamVR_TrackedObject[] trackedObjects = FindObjectsOfType<SteamVR_TrackedObject>(); foreach (SteamVR_TrackedObject tracked in trackedObjects) { if (tracked.index == SteamVR_TrackedObject.EIndex.Hmd) { hmdTrackedObject = tracked; break; } } } } private void DebugLogger(uint index, string button, string action, ControllerInteractionEventArgs e) { Debug.Log("Controller on index '" + index + "' " + button + " has been " + action + " with a pressure of " + e.buttonPressure + " / trackpad axis at: " + e.touchpadAxis + " (" + e.touchpadAngle + " degrees)"); } }