void AddInternal(SteamVR_Camera vrcam) { try { var camera = vrcam.GetComponent <Camera>(); var length = cameras.Length; var sorted = new SteamVR_Camera[length + 1]; int insert = 0; for (int i = 0; i < length; i++) { var c = cameras[i].GetComponent <Camera>(); if (i == insert && c.depth > camera.depth) { sorted[insert++] = vrcam; } sorted[insert++] = cameras[i]; } if (insert == length) { sorted[insert] = vrcam; } cameras = sorted; } catch (Exception e) { Console.WriteLine(e); } }
void AddInternal(SteamVR_Camera vrcam) { var camera = vrcam.GetComponent <Camera>(); var length = cameras.Length; var sorted = new SteamVR_Camera[length + 1]; int insert = 0; for (int i = 0; i < length; i++) { var c = cameras[i].GetComponent <Camera>(); if (i == insert && c.depth > camera.depth) { sorted[insert++] = vrcam; } sorted[insert++] = cameras[i]; } if (insert == length) { sorted[insert] = vrcam; } cameras = sorted; #if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) enabled = true; #endif }
// Use this for initialization void Start() { cnt = 0; revervespeed = speed; tp1 = GetComponent <Rigidbody>(); tp = GameObject.Find("Object").GetComponent <Rigidbody>(); subpush = GameObject.Find("Subject").GetComponent <Rigidbody>(); tt = GameObject.Find("Subject").GetComponent <AudioSource>(); camtransform = cam.GetComponent <Transform>(); updis = Vector3.Distance(camtransform.position, transform.position); line = GameObject.Find("line").GetComponent <Transform>(); //tt.pitch = GetComponent<Rigidbody>().velocity.magnitude / (speed*updis); //tt.Play (); //tt.volume = 0.8f; sphereradius = GetComponent <SphereCollider>().radius; subradius = sphereradius * gameObject.transform.localScale.magnitude; //print(cnt); target = GameObject.Find("Object").GetComponent <Transform>(); //pp.velocity = new Vector3 (0, 1, 0); /*tmp1 =target.transform.position-transform.position; * linerspeed =Quaternion.Euler(0,90,0)*tmp1; * pp.velocity = linerspeed; * radius = (transform.position - target.transform.position).magnitude; * print (radius); * speed = linerspeed.magnitude; * omga = speed * speed / radius; */ position.AddLast(transform.position); }
//public float screendistance; // Use this for initialization void Start() { pp = GetComponent <Rigidbody2D> (); distance = (target.transform.position - transform.position).magnitude; camtransform = cam.GetComponent <Transform>(); angularvelocity = 13.2f * Mathf.PI / 180f; speed = angularvelocity; // steamvr = GameObject.Find("SteamVR"); //steamvr.transform.position = new Vector3(steamvr.transform.position.x,steamvr.transform.position.y,screendistance); }
// Token: 0x060055B2 RID: 21938 RVA: 0x001D894C File Offset: 0x001D6D4C public override void Awake() { base.Awake(); this.mouseGaze = base.GetComponentInChildren <NeckMouseRotator>(); this.neckTransform = this.mouseGaze.transform; this.gameView = base.GetComponentInChildren <SteamVR_GameView>(); this.eyeTransform = this.neckTransform.GetChild(0); this.postCamera = this.gameView.GetComponent <Camera>(); SteamVR_Camera componentInChildren = base.GetComponentInChildren <SteamVR_Camera>(); this.eyeCamera = componentInChildren.GetComponent <Camera>(); }
void Start() { // print(VRTK.Examples.UI_interaction_set.cnt_pinkonly); camtransform = cam.GetComponent <Transform>(); time = VRTK.Examples.UI_interaction_set.delaytime; time *= (float)0.05; sub = GameObject.Find("Subject"); obj = GameObject.Find("Object"); pp = GameObject.Find("Subject").GetComponent <AudioSource>(); pp1 = GameObject.Find("Object").GetComponent <AudioSource>(); sp = File.AppendText("c:/upennVR/RECORD2dtrial.TXT"); sp.WriteLine(""); sp.Write("Trial " + VRTK.Examples.UI_interaction_set.cnt_red + " : "); // pp.Stop(); if (VRTK.Examples.UI_interaction_set.soundset == 2) { pp.Play(); //sp.WriteLine("Have rolling sound."); sp.Write(" √ "); } else { sp.Write(" × "); } tp = GameObject.Find("Object").GetComponent <Rigidbody2D>(); tp1 = GameObject.Find("Subject").GetComponent <Rigidbody2D>(); relamass = 2 * tp1.mass / (tp.mass + tp1.mass); subr = GameObject.Find("Subject").GetComponent <CircleCollider2D>().radius; subr *= tp1.transform.localScale.magnitude; print(subr); if (VRTK.Examples.UI_interaction_set.delaytime != 0) { recordtime = time; soundtime = time / 2; } else { recordtime = 0f; soundtime = 0f; } ob = GameObject.Find("Object"); emitter = GameObject.Find("emitter").GetComponent <AudioSource>(); cnt = 0; /* scroll = GameObject.Find("choose"); * scroll.SetActive(false); * rating = GameObject.Find("rating"); * rating.SetActive(false); * submit = GameObject.Find("submit"); * submit.SetActive(false); */ }
// Use this for initialization void Start() { pp = GameObject.Find("Object").GetComponent <AudioSource>(); ob = GameObject.Find("Object"); tp = GameObject.Find("Object").GetComponent <Rigidbody>(); tp1 = GameObject.Find("Subject").GetComponent <Rigidbody>(); target = GameObject.Find("Object").GetComponent <Transform>(); emitter = GameObject.Find("emitter").GetComponent <AudioSource>(); camtransform = cam.GetComponent <Transform>(); updis = Vector3.Distance(transform.position, camtransform.position); masschange = 2 * tp1.mass / (tp1.mass + tp.mass); emitter.clip = csound; sp = File.AppendText("c:/upennVR/RECORD.TXT"); // pp.clip = dsound; }
// Use this for initialization void Start() { pp = GameObject.Find("Object").GetComponent <AudioSource>(); ob = GameObject.Find("Object"); tp = GameObject.Find("Object").GetComponent <Rigidbody>(); tp1 = GameObject.Find("Subject").GetComponent <Rigidbody>(); emitter = GameObject.Find("emitter").GetComponent <AudioSource>(); target = GameObject.Find("Object").GetComponent <Transform>(); sphereradius = GameObject.Find("Object").GetComponent <SphereCollider>().radius; subradius = sphereradius * ob.transform.localScale.magnitude; camtransform = cam.GetComponent <Transform>(); updis = Vector3.Distance(transform.position, camtransform.position); masschange = 2 * tp1.mass / (tp1.mass + tp.mass); subb = GameObject.Find("Object").GetComponent <Transform>(); pp.clip = dsound; emitter.clip = csound; sp = File.AppendText("c:/upennVR/RECORD.TXT"); }
private void AddInternal(SteamVR_Camera vrcam) { if (vrcam == null) { return; } Camera component = vrcam.GetComponent <Camera>(); if (component == null) { return; } int num = this.cameras.Length; SteamVR_Camera[] array = new SteamVR_Camera[num + 1]; int num2 = 0; bool flag = false; for (int i = 0; i < num; i++) { SteamVR_Camera steamVR_Camera = this.cameras[i]; if (!(steamVR_Camera == null)) { if (!array.Contains(steamVR_Camera)) { Camera component2 = steamVR_Camera.GetComponent <Camera>(); if (!(component2 == null)) { if (i == num2 && component2.depth > component.depth) { array[num2++] = vrcam; flag = true; } array[num2++] = steamVR_Camera; } } } } if (!flag) { array[num2] = vrcam; } this.cameras = array; }
void AddInternal(SteamVR_Camera vrcam) { var camera = vrcam.GetComponent<Camera>(); var length = cameras.Length; var sorted = new SteamVR_Camera[length + 1]; int insert = 0; for (int i = 0; i < length; i++) { var c = cameras[i].GetComponent<Camera>(); if (i == insert && c.depth > camera.depth) sorted[insert++] = vrcam; sorted[insert++] = cameras[i]; } if (insert == length) sorted[insert] = vrcam; cameras = sorted; }
public Material GetSkyboxMaterial() { foreach (var childSkybox in transform.GetComponentsInChildren <Skybox>()) { if (childSkybox.enabled) { return(childSkybox.material); } } var trackerSkybox = tracker.GetComponent <Skybox>(); if (trackerSkybox && trackerSkybox.enabled) { return(trackerSkybox.material); } return(RenderSettings.skybox); }
void Start() { rig = GameObject.Find("[CameraRig]"); tController = GetComponent <SteamVR_TrackedController>(); eye = GameObject.FindObjectOfType <SteamVR_Camera>(); blur = eye.GetComponent <BlurOptimized>(); tController.PadClicked += StartBlur; tController.PadUnclicked += StopBlur; tController.Gripped += StartBlur; tController.Ungripped += StopBlur; tController.TriggerClicked += OnTrigger; tController.TriggerUnclicked += OnTrigger; if (GetComponent <SteamVR_LaserPointer>()) { GetComponent <SteamVR_LaserPointer>().PointerIn += OnPointerIn; GetComponent <SteamVR_LaserPointer>().PointerOut += OnPointerOut; } lastPos = eye.transform.position; }
// Use this for initialization void Start() { camtransform = cam.GetComponent <Transform>(); centertransform = camtransform.position; print(centertransform); radius = r; transform.position = new Vector3(camtransform.position.x + sx, transform.position.y, camtransform.position.z + Mathf.Sqrt(r * r - sx * sx)); camtransform.LookAt(transform.position); angle_subject = Mathf.Atan(transform.position.z / transform.position.x); //print((transform.position - camtransform.position).magnitude); //print(angle_subject); Vector3 pp = new Vector3(camtransform.position.x, transform.position.y, camtransform.position.z); ob = GameObject.Find("Object").GetComponent <Transform>(); ob.position = new Vector3(camtransform.position.x + ox, transform.position.y, camtransform.position.z + Mathf.Sqrt(r * r - ox * ox)); angle_object = Mathf.Atan(ob.position.z / ob.position.x); //print(angle_object); angle_now = Vector3.Angle(transform.position - pp, ob.transform.position - pp); print(angle_now); //print(Vector3.Distance(camtransform.position, transform.position)); //print(Vector3.Distance( ob.position,camtransform.position)); // print(radius); }
// Token: 0x06005F55 RID: 24405 RVA: 0x00217B50 File Offset: 0x00215F50 private void AddInternal(SteamVR_Camera vrcam) { Camera component = vrcam.GetComponent <Camera>(); int num = this.cameras.Length; SteamVR_Camera[] array = new SteamVR_Camera[num + 1]; int num2 = 0; for (int i = 0; i < num; i++) { Camera component2 = this.cameras[i].GetComponent <Camera>(); if (i == num2 && component2.depth > component.depth) { array[num2++] = vrcam; } array[num2++] = this.cameras[i]; } if (num2 == num) { array[num2] = vrcam; } this.cameras = array; }
private void AddInternal(SteamVR_Camera vrcam) { var camera = vrcam.GetComponent <Camera>(); var length = cameras.Length; var sorted = new SteamVR_Camera[length + 1]; int insert = 0; for (int i = 0; i < length; i++) { var c = cameras[i].GetComponent <Camera>(); if (i == insert && c.depth > camera.depth) { sorted[insert++] = vrcam; } sorted[insert++] = cameras[i]; } if (insert == length) { sorted[insert] = vrcam; } cameras = sorted; }
// Use this for initialization void Start() { cnt = 0; revervespeed = speed; tp1 = GetComponent <Rigidbody>(); tp = GameObject.Find("Object").GetComponent <Rigidbody>(); tt = GameObject.Find("Subject").GetComponent <AudioSource>(); //tt.Play (); //tt.volume = 0.8f; print(cnt); target = GameObject.Find("Object").GetComponent <Transform>(); //pp.velocity = new Vector3 (0, 1, 0); camtransform = cam.GetComponent <Transform>(); /*tmp1 =target.transform.position-transform.position; * linerspeed =Quaternion.Euler(0,90,0)*tmp1; * pp.velocity = linerspeed; * radius = (transform.position - target.transform.position).magnitude; * print (radius); * speed = linerspeed.magnitude; * omga = speed * speed / radius; */ obr = GameObject.Find("Object").GetComponent <SphereCollider>().radius; }
/// <summary> /// Automatically configure the SteamVR camera rig object in the scene. /// </summary> /// <returns>True if successful, false if there was an error.</returns> public bool Configure() { if (!cameraRig) { Debug.LogWarning("Holojam.Vive.ViveModule: Camera rig not assigned!"); return(false); } SteamVR_ControllerManager controllers = cameraRig.GetComponent <SteamVR_ControllerManager>() as SteamVR_ControllerManager; // Add/update controller relays Action <Type> ConfigureController = type => { GameObject controller = type == Type.LEFT ? controllers.left : controllers.right; if (controller) { ViveControllerRelay relay = controller.GetComponent <ViveControllerRelay>() as ViveControllerRelay; if (!relay) { relay = controller.AddComponent <ViveControllerRelay>() as ViveControllerRelay; } relay.type = type; } else { Debug.Log("Holojam.Vive.ViveModule: Controller not found: " + TypeToString(type)); } }; if (controllers) { ConfigureController(Type.LEFT); ConfigureController(Type.RIGHT); } // Add/update Vive relay SteamVR_Camera camera = cameraRig.GetComponentInChildren <SteamVR_Camera>() as SteamVR_Camera; if (camera) { if (!camera.GetComponent <Tools.ActorTransformRelay>()) { camera.gameObject.AddComponent <Tools.ActorTransformRelay>(); } } else { Debug.LogWarning( "Holojam.Vive.ViveModule: SteamVR camera not found. " + "Did you assign the correct game object to the camera rig field?" ); return(false); } Debug.Log("Holojam.Vive.ViveModule: Configure successful!"); return(true); }