// Use this for initialization void Start() { trackedObj = GetComponent<SteamVR_TrackedObject>(); DrawLine = this.gameObject.AddComponent<LineRenderer>(); //DrawLine.material = DrawLine.SetWidth(0, 3); }
// Use this for initialization void Awake() { flipperBase = Instantiate(flipperBase); myFlipper = flipperBase.GetComponent<SteamVR_TrackedObject>(); myFlipper.origin = gameObject.transform; myFlipper.SetDeviceIndex(++numControllers); }
void Awake() { trackedObj = GetComponent<SteamVR_TrackedObject>(); attachPoint = attachObject.GetComponent<Rigidbody>(); }
void OnTriggerExit(Collider other) { trackedController = other.GetComponent<SteamVR_TrackedObject>(); if (trackedController != null) { inSlingShot = false; } }
void Awake() { trackedObj = GetComponent<SteamVR_TrackedObject>(); cooldownInstance = GameObject.Instantiate(cooldownIndicator); cooldownInstance.transform.localScale = Vector3.one * 0.01f; }
// Use this for initialization void Start() { trackedObj = transform.parent.GetComponent<SteamVR_TrackedObject>(); bruce = GameObject.FindWithTag("Player").GetComponent<CharactorBruce>(); if(null == currentWeapon) { SwapWeapon(); } }
void Awake() { trackedObj = GetComponent<SteamVR_TrackedObject>(); if (useCollider) { gameObject.AddComponent<SphereCollider>(); gameObject.GetComponent<SphereCollider>().radius = 0.05f; } }
// Use this for initialization void Start() { m_TrackedObj = GetComponent<SteamVR_TrackedObject>(); m_TrackedCtl = GetComponent<SteamVR_TrackedController>(); m_Hand = GetComponent<NewtonVR.NVRHand>(); m_TrackedCtl.TriggerClicked += TriggerDown; m_TrackedCtl.TriggerUnclicked += TriggerUp; m_ColliderList = GetComponentsInChildren<Collider>(); }
// Use this for initialization void Start() { controller = GetComponentInParent<SteamVR_TrackedObject>(); laser.transform.localRotation *= Quaternion.Euler(180,0,0); laser.SetActive(false); for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(true); } canFire = true; }
private void Awake() { if (GetComponent<SteamVR_InteractTouch>() == null) { Debug.LogError("SteamVR_InteractUse is required to be attached to a SteamVR Controller that has the SteamVR_InteractTouch script attached to it"); return; } interactTouch = GetComponent<SteamVR_InteractTouch>(); trackedController = GetComponent<SteamVR_TrackedObject>(); controllerActions = GetComponent<SteamVR_ControllerActions>(); }
// Initialization void Start() { // For safety if (!isServer || !isLocalPlayer) return; motor = GetComponent<PlayerMotor>(); playerAudio = GetComponent<AudioSource>(); // Setting up the Vive tracked objects - for getting index of controller leftTrackedObject = this.transform.Find("[CameraRig]").Find("Controller (left)").GetComponent<SteamVR_TrackedObject>(); rightTrackedObject = this.transform.Find("[CameraRig]").Find("Controller (right)").GetComponent<SteamVR_TrackedObject>(); }
//FixedJoint ObjectsJoint; void Awake() { trackedObj = GetComponent<SteamVR_TrackedObject>(); //TextCompensateLocation = new GameObject(); Self = this.GetComponent<Rigidbody>(); if (DebugMode == true) { //TextCompensateLocation.parent DebugText = this.gameObject.AddComponent<TextMesh>(); DebugText.characterSize = 0.01f; DebugText.offsetZ = -0.1f; } }
void Start() { targetMarker.SetActive(false); //任意のViveコントローラーから取得 trackedObj = GetComponent<SteamVR_TrackedObject>(); //デバイスの入力受け付け var device = SteamVR_Controller.Input((int)trackedObj.index); this.UpdateAsObservable() //Updateが呼ばれた時 .Where(_ => device.GetTouch(SteamVR_Controller.ButtonMask.Trigger)) //コントローラーのトリガーを押している間 .Subscribe(_ => targetMarker.SetActive(true)); this.UpdateAsObservable() .Where(_ => device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger)) //コントローラーのトリガーを離したとき .Subscribe(_ => moveToPoint()); //ターゲットマーカーの位置へ移動 }
// Update is called once per frame void FixedUpdate () { if(trackedObj==null) trackedObj = GameObject.Find("Controller(left)(Instructor)").GetComponent<SteamVR_TrackedObject>(); transform.LookAt(Camera.main.transform); var device = SteamVR_Controller.Input((int)trackedObj.index); gameObject.transform.position = new Vector3((device.GetAxis(Valve.VR.EVRButtonId.k_EButton_Axis0).x)*-range, (device.GetAxis(Valve.VR.EVRButtonId.k_EButton_Axis0).y)+ 2.75F, gameObject.transform.position.z); Vector3 toCamera = Camera.main.transform.position - this.transform.position; if (device.GetTouch(SteamVR_Controller.ButtonMask.Trigger)) { if (charge <= 5.0f) charge += Time.deltaTime; else charge = 5f; var temp = (charge / (2) + size); this.transform.localScale = new Vector3(temp, temp, temp); } else if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger)) { Destroy(GameObject.Find("RicePaperWall0"), 5); this.transform.localScale = new Vector3(size, size, size); if (charge < 2) { GameObject bPrefab = Instantiate(Prefab[Random.Range(0, Prefab.Length - 1)], PoofRef.position, Quaternion.identity) as GameObject; bPrefab.GetComponent<Rigidbody>().AddForce(toCamera * 50f, ForceMode.Impulse); bPrefab.GetComponent<Rigidbody>().AddTorque(new Vector3(Random.Range(-200, 200), 200, Random.Range(-200,200))); PoofRef.GetComponent<CartoonExplosionFX>().Play(); Sound.Play(); } else { GameObject bPrefab = Instantiate(Prefab[Prefab.Length - 1], PoofRef.position, Quaternion.identity) as GameObject; bPrefab.GetComponent<Rigidbody>().AddForce(toCamera / ((charge / 5) + 1) * 2000f); bPrefab.transform.localScale = bPrefab.transform.localScale * ((charge / 5) + 1); PoofRef.GetComponent<CartoonExplosionFX>().Play(); Sound.Play(); } charge = 1f; } }
// Update is called once per frame void Update() { if (!trackedObj) trackedObj = GetComponent<SteamVR_TrackedObject>(); if (trackedObj != null) { device = SteamVR_Controller.Input((int)trackedObj.index); } if (device != null) { triggerPress = device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger); triggerState = device.GetTouch(SteamVR_Controller.ButtonMask.Trigger); mainButtonPressed = device.GetTouch(SteamVR_Controller.ButtonMask.ApplicationMenu); secondaryButtonPressed = device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad); touchpadVector = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad); } }
void getTrigger( GameObject go , SteamVR_TrackedObject tObj ){ if((int) tObj.index < 0 ){ return; } var device = SteamVR_Controller.Input((int)tObj.index); if ( device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger)){ if(OnTriggerDown != null) OnTriggerDown(go); } if ( device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger)){ if(OnTriggerUp != null) OnTriggerUp(go); } if ( device.GetTouch(SteamVR_Controller.ButtonMask.Trigger)){ if(StayTrigger != null) StayTrigger(go); } }
// Use this for initialization void Start() { // If the player is the host and the object in the scene is the localplayer's character, initialize the Steam controller if (isServer && isLocalPlayer) { rightTrackedObject = this.transform.Find("[CameraRig]").Find("Controller (right)").GetComponent<SteamVR_TrackedObject>(); } // Determining the camera based on if the person is a seeker or hider string whichCamera; if (isServer && isLocalPlayer) { whichCamera = "FirstPerson"; UIText = firstPersonText; } else { whichCamera = "ThirdPerson"; UIText = thirdPersonText; } myCamera = transform.Find(whichCamera).GetComponent<Camera>(); doorController = GetComponent<DoorController>(); timer = GameObject.Find("Timer").GetComponent<Timer>(); // record the spawn place, used to respawn spawnPosition = transform.position; spawnRotation = transform.rotation; rigidBody = GetComponent<Rigidbody>(); // TEMPORARY solution: the server is the hunter if (isServer) { if (isLocalPlayer) { isActive = true; this.transform.Find ("[CameraRig]").gameObject.SetActive (true); } else { isActive = false; } } // wait at the beginning of the game if (isActive) { waiting = true; GetComponent<myViveController>().enabled = false; } }
void Update() { SteamVR_ControllerManager manager = GetComponent<SteamVR_ControllerManager>(); if (manager.right.activeInHierarchy) { TrackedController = manager.right.GetComponent<SteamVR_TrackedController>(); TrackedObject = manager.right.GetComponent<SteamVR_TrackedObject>(); } else if (manager.left.activeInHierarchy) { TrackedController = manager.left.GetComponent<SteamVR_TrackedController>(); TrackedObject = manager.left.GetComponent<SteamVR_TrackedObject>(); } else { TrackedController = null; TrackedObject = null; } }
//Transform _previousParent; // Use this for initialization void Start() { _trackedObject = GetComponent<SteamVR_TrackedObject>(); if (_trackedObject == null) { Debug.Log("HandTrack.cs: Couldn't find a TrackedObject component"); } if (_trackedObject) _inputDevice = SteamVR_Controller.Input((int)_trackedObject.index); // if (_attachedStick) // { // _textPrompt = _attachedStick.GetComponent<TextMesh>(); // } leftPos = _player.transform.TransformPoint(new Vector3(-1, 0, 0)); rightPos = _player.transform.TransformPoint(new Vector3(1, 0, 0)); }
private void Awake() { trackedController = GetComponent<SteamVR_TrackedObject>(); controllerActions = GetComponent<VRTK_ControllerActions>(); }
// Use this for initialization void Start() { myTrackedObject = GetComponent <SteamVR_TrackedObject>(); }
private void HandleTriggerDown(SteamVR_TrackedObject hand) { SoundManager.Instance.PlayPressedSound(); text.color = pressed; }
void Awake() { trackedObj = GetComponent<SteamVR_TrackedObject>(); cgo = this.GetComponent<ControllerGrabObject>(); }
void OnEnable() { // Bail if no hmd is connected var vr = SteamVR.instance; if (vr == null) { if (head != null) { // Adjusted to this from original Valve code because head was non-null // but did not contain a steamVR_TrackedObject - Jimmy SteamVR_TrackedObject x = head.GetComponent <SteamVR_TrackedObject> (); if (x != null) { x.enabled = false; } } enabled = false; return; } // Convert camera rig for native OpenVR integration. var t = transform; if (head != t) { Expand(); t.parent = origin; while (head.childCount > 0) { head.GetChild(0).parent = t; } // Keep the head around, but parent to the camera now since it moves with the hmd // but existing content may still have references to this object. head.parent = t; head.localPosition = Vector3.zero; head.localRotation = Quaternion.identity; head.localScale = Vector3.one; head.gameObject.SetActive(false); _head = t; } if (ears == null) { var e = transform.GetComponentInChildren <SteamVR_Ears>(); if (e != null) { _ears = e.transform; } } if (ears != null) { ears.GetComponent <SteamVR_Ears>().vrcam = this; } SteamVR_Render.Add(this); }
// Use this for initialization void Start() { trackedObject = GetComponent <SteamVR_TrackedObject>(); device = SteamVR_Controller.Input((int)trackedObject.index); }
// Use this for initialization void Start() { tracked = GetComponent <SteamVR_TrackedObject>(); NotificationCenter.DefaultCenter().AddObserver(this, "ControllerShake"); }
// Initialize void Start() { trackedObj = GetComponent <SteamVR_TrackedObject>(); fixedJoint = GetComponent <FixedJoint>(); }
public void TrackObject(SteamVR_TrackedObject trackedObject) { _trackedObject = trackedObject; }
void Start() { trackedObj = GetComponent <SteamVR_TrackedObject>(); colorer.SetFunctional(false); }
void Start() { _tr = this.transform; _trackedObj = this.GetComponent<SteamVR_TrackedObject>(); }
private void HandleHighlight(SteamVR_TrackedObject hand) { SoundManager.Instance.PlayHighlightSound(); text.color = highlight; }
// Use this for initialization void Start() { trackedObj = GetComponent <SteamVR_TrackedObject>(); controllerType = Helper.GetControllerType(rightController); }
public void SetDevice(SteamVR_TrackedObject obj) { trackedObj = obj; source = GetComponent <AudioSource>(); }
// Use this for initialization void Awake() { tracked = GetComponent <SteamVR_TrackedObject>(); interact = GetComponent <Interaction>(); }
// Use this for initialization void Awake() { this.controller = GetComponent <SteamVR_TrackedObject>(); this.gravity = GameObject.Find("Ball").GetComponent <Rigidbody>(); }
// Use this for initializationmany void Awake () { trackedObj = GetComponent<SteamVR_TrackedObject>(); parentInstance = Instantiate(parent, Vector3.zero, Quaternion.identity) as GameObject; }
void Start() { controller = controllerRight.GetComponent <SteamVR_TrackedController> (); controller.TriggerClicked += TriggerPressed; trackedObj = controllerRight.GetComponent <SteamVR_TrackedObject> (); }
// Use this for initialization void Start() { trackedObj = GetComponent<SteamVR_TrackedObject>(); }
// Use this for initialization void Awake() { this.controller = GetComponent <SteamVR_TrackedObject>(); this.ballRigidBody = GameObject.Find("Player").GetComponent <Rigidbody>(); }
private void GetTrackedObject() { trackedObj = GetComponent <SteamVR_TrackedObject>(); }
// Use this for initialization void Start() { trackedObj = GetComponent <SteamVR_TrackedObject> (); rb = cameraRig.GetComponent <Rigidbody> (); }
public override void OnEnter() { GameObject go = Fsm.GetOwnerDefaultTarget(controller); trackedObj = go.GetComponent<SteamVR_TrackedObject>(); }
// Use this for initialization void Start() { trackedObj = GetComponent<SteamVR_TrackedObject>(); device = SteamVR_Controller.Input((int)trackedObj.index); light = GetComponentInChildren<Light>(); }
private void HandleTriggerUp(SteamVR_TrackedObject hand) { text.color = highlight; GameController.Instance.GotoGame(); }
void Update() { // If we are currently teleporting (ie handling the fade in/out transition)... if(Teleporting) { // Wait until half of the teleport time has passed before the next event (note: both the switch from fade // out to fade in and the switch from fade in to stop the animation is half of the fade duration) if(Time.time - TeleportTimeMarker >= TeleportFadeDuration / 2) { if(FadingIn) { // We have finished fading in Teleporting = false; } else { // We have finished fading out - time to teleport! Vector3 offset = OriginTransform.position - HeadTransform.position; offset.y = 0; OriginTransform.position = Pointer.SelectedPoint + offset; } TeleportTimeMarker = Time.time; FadingIn = !FadingIn; } return; } // At this point, we are NOT actively teleporting. So now we care about controller input. if (ActiveController != null) { // Here, there is an active controller - that is, the user is holding down on the trackpad. // Poll controller for pertinent button data int index = (int)ActiveController.index; var device = SteamVR_Controller.Input(index); bool shouldTeleport = device.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad); bool shouldCancel = device.GetPressUp(SteamVR_Controller.ButtonMask.Grip); if (shouldTeleport || shouldCancel) { // If the user has decided to teleport (ie lets go of touchpad) then remove all visual indicators // related to selecting things and actually teleport // If the user has decided to cancel (ie squeezes grip button) then remove visual indicators and do nothing if(shouldTeleport && Pointer.PointOnNavMesh) { // Begin teleport sequence Teleporting = true; TeleportTimeMarker = Time.time; } // Reset active controller, disable pointer, disable visual indicators ActiveController = null; Pointer.enabled = false; RoomBorder.enabled = false; //RoomBorder.Transpose = Matrix4x4.TRS(OriginTransform.position, Quaternion.identity, Vector3.one); if (NavmeshAnimator != null) NavmeshAnimator.SetBool(EnabledAnimatorID, false); Pointer.transform.parent = null; Pointer.transform.position = Vector3.zero; Pointer.transform.rotation = Quaternion.identity; Pointer.transform.localScale = Vector3.one; } else { // The user is still deciding where to teleport and has the touchpad held down. // Note: rendering of the parabolic pointer / marker is done in ParabolicPointer Vector3 offset = HeadTransform.position - OriginTransform.position; offset.y = 0; // Render representation of where the chaperone bounds will be after teleporting RoomBorder.Transpose = Matrix4x4.TRS(Pointer.SelectedPoint - offset, Quaternion.identity, Vector3.one); // Haptic feedback click every [HaptickClickAngleStep] degrees float angleClickDiff = Pointer.CurrentParabolaAngle - LastClickAngle; if(Mathf.Abs(angleClickDiff) > HapticClickAngleStep) { LastClickAngle = Pointer.CurrentParabolaAngle; device.TriggerHapticPulse(); } } } else { // At this point the user is not holding down on the touchpad at all or has canceled a teleport and hasn't // let go of the touchpad. So we wait for the user to press the touchpad and enable visual indicators // if necessary. foreach (SteamVR_TrackedObject obj in Controllers) { int index = (int)obj.index; if (index == -1) continue; var device = SteamVR_Controller.Input(index); if (device.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad)) { // Set active controller to this controller, and enable the parabolic pointer and visual indicators // that the user can use to determine where they are able to teleport. ActiveController = obj; Pointer.transform.parent = obj.transform; Pointer.transform.localPosition = Vector3.zero; Pointer.transform.localRotation = Quaternion.identity; Pointer.transform.localScale = Vector3.one; Pointer.enabled = true; RoomBorder.enabled = true; if(NavmeshAnimator != null) NavmeshAnimator.SetBool(EnabledAnimatorID, true); Pointer.ForceUpdateCurrentAngle(); LastClickAngle = Pointer.CurrentParabolaAngle; } } } }
private void Awake() { trackedController = GetComponent <SteamVR_TrackedObject>(); this.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast"); storedMaterials = new Dictionary <GameObject, Material>(); }
private void HandleUnHighlight(SteamVR_TrackedObject hand) { text.color = normal; }
void Awake() { trackedObj = transform.parent.parent.GetComponent <SteamVR_TrackedObject>(); }
void Awake(){ trackedObj = GetComponent<SteamVR_TrackedObject>(); sliderX = 0; sliderY = 0; }
// Update is called once per frame void Update() { SteamVR_TrackedObject trackedObject = GetComponent <SteamVR_TrackedObject>(); if (setup) { //Debug.Log("inc is "+inc+", lockAct is "+lockAct+", dec is "+dec); //Debug.Log("Input: trigger "+Trigger_Touch.GetState(Handtype)+", Touchpad "+JoyStick_Click.GetState(Handtype)); //ブラックアウトが消えるまで待機 if (!act) //!act { if (count < maxCount) { blackPanel.GetComponent <blackOut>().changeAlpha(-0.02f); //Debug.Log("count is "+count+", maxCount is "+ maxCount); //あとでコメントアウト if (blackPanel.GetComponent <blackOut>().alfa < 0.0f) { lockAct = true; act = true; blackPanel.GetComponent <blackOut>().alfa = 0.0f; //Debug.Log("black is under 0"); } } } //ブラックアウトしていない・操作許可 else if (lockAct) //lockact { //Debug.Log("lockAct is true"); //タッチイベント if (count < maxCount) { //Debug.Log("input trigger or touchpad"); //あとでコメントアウト if (trigger_touch.GetState(Handtype)) { Debug.Log("トリガーを深く引いた"); Debug.Log("lower : deg = " + recoder.GetComponent <getRecorder>().randomArray[count] + ". count is " + count); Debug.Log("head : deg = " + (360f - camPos.localEulerAngles.x).ToString()); recoder.GetComponent <getRecorder>().recodeData(recoder.GetComponent <getRecorder>().randomArray[count] + ",0," + (360f - camPos.localEulerAngles.x).ToString() + "\n"); //angles.Add(camPos.localEulerAngles.x.ToString()); lockAct = false; } if (click_button.GetState(Handtype)) { Debug.Log("タッチパッドをクリックした"); Debug.Log("upward : deg = " + recoder.GetComponent <getRecorder>().randomArray[count] + ". count is " + count); Debug.Log("head : deg = " + (360f - camPos.localEulerAngles.x).ToString()); recoder.GetComponent <getRecorder>().recodeData(recoder.GetComponent <getRecorder>().randomArray[count] + ",1," + (360f - camPos.localEulerAngles.x).ToString() + ",\n"); //angles.Add(camPos.localEulerAngles.x.ToString()); lockAct = false; } } } //ブラックアウトしカメラ回転 else if (!lockAct) //!lockact { //Debug.Log("lockAct is false"); blackPanel.GetComponent <blackOut>().changeAlpha(0.02f); if (blackPanel.GetComponent <blackOut>().alfa > 2.0f) { //Debug.Log("alpha is over 2"); act = false; lockAct = false; blackPanel.GetComponent <blackOut>().alfa = 1.0f; //camPose.position = new Vector3(0, -0.8f, Random.Range(0f, 200f)); camPose.position = new Vector3(0, 0, Random.Range(0f, 200f)); count++; if (count < maxCount) { rollCam.GetComponent <startRotation>().StartRotate(recoder.GetComponent <getRecorder>().randomArray[count]); } else { Debug.Log("END"); } } } } }
void Awake() { trackedObj = GetComponent <SteamVR_TrackedObject>(); }
void Reset() { target = GetComponent <SteamVR_TrackedObject>(); }
private void Awake() { trackedController = GetComponent<SteamVR_TrackedObject>(); }
// Use this for initialization void Start() { trackedObj = GetComponent <SteamVR_TrackedObject>(); laser = GetComponentInChildren <LineRenderer>(); }
void Start() { objtracked = GetComponent <SteamVR_TrackedObject> (); }
void Start() { trackedObj = GetComponent <SteamVR_TrackedObject>(); radialColors.SetActive(false); }
void Awake() { trackedObj = GetComponent<SteamVR_TrackedObject>(); }
private void Awake() { trackedController = GetComponent <SteamVR_TrackedObject>(); }
private void Awake() { trackedController = GetComponent<SteamVR_TrackedObject>(); this.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast"); }
void Start() { controller = gameObject.GetComponent <SteamVR_TrackedObject>(); }