// public Clock clock = Timekeeper.instance.Clock(Root.ToString()); // Start is called before the first frame update void Start() { clock = Timekeeper.instance.Clock(Root.ToString()); Sphere = GameObject.Find("Environment/Dynamic/" + sphere.ToString()); ovrgrababble = Sphere.gameObject.GetComponent <OVRGrabbable>(); Controltimescale = GameObject.Find("Timekeeper").GetComponent <controltimescale>(); }
void OnTriggerEnter(Collider otherCollider) { // Get the grab trigger OVRGrabbable grabbable = otherCollider.GetComponent <OVRGrabbable>() ?? otherCollider.GetComponentInParent <OVRGrabbable>(); if (grabbable == null) { return; } /* * * GameObject grabbed = otherCollider.gameObject ?? otherCollider.transform.parent.gameObject; * * int Size = InputManager.GetComponent<InputManager>().SizeState; * if (Size != 3 && grabbed.CompareTag ("Large")) return; * if (Size == 1 && grabbed.CompareTag("Medium")) return; * * if (grabbed.CompareTag("Shrimp")) InputManager.GetComponent<InputManager>().ShrimpGrabbed = true; * if (grabbed.CompareTag("Watermelon")) InputManager.GetComponent<InputManager>().WatermelonGrabbed = true; * */ // Add the grabbable int refCount = 0; m_grabCandidates.TryGetValue(grabbable, out refCount); m_grabCandidates[grabbable] = refCount + 1; }
// Start is called before the first frame update void Start() { simpleShoot = GetComponent <SimpleShoot>(); ovrGrabbable = GetComponent <OVRGrabbable>(); bulletText = GameObject.Find("Label Text").GetComponent <TextMeshProUGUI>(); //bulletText.text = maxNumberOfBullet.ToString(); }
// Update is called once per frame void Update() { //identifies if an object is being held in the right hand if (grabbedObjRight.grabbedObject != null) { heldObj = grabbedObjRight.grabbedObject; } else { heldObj = null; } //identifies if pocket container is held in left hand if (grabbedObjLeft.grabbedObject != null) { if (grabbedObjLeft.grabbedObject.name == this.gameObject.name) { isHeld = true; } } else { isHeld = false; } }
void OnTriggerEnter(Collider other) { virus = other.transform.root.GetComponent <Virus>(); if (virus != null) { microscopeUI.gameObject.SetActive(true); microscopeUI.virus = virus; doorUI.Close(); Rigidbody body = other.transform.root.GetComponent <Rigidbody>(); body.MovePosition(containerPlacemat.position); body.MoveRotation(containerPlacemat.rotation); body.isKinematic = true; OVRGrabbable grabbable = other.transform.root.GetComponent <OVRGrabbable>(); if (grabbable != null) { OVRGrabber grabber = grabbable.grabbedBy; if (grabber != null) { grabber.ForceRelease(grabbable); } } } }
private OVRGrabbable FindClosestGrabble()// This func from OVRGrabber { float closestMagSq = float.MaxValue; OVRGrabbable closestGrabbable = null; Collider closestGrabbableCollider = null; // Iterate grab candidates and find the closest grabbable candidate foreach (OVRGrabbable grabbable in m_grabCandidates.Keys) { bool canGrab = !(grabbable.isGrabbed && !grabbable.allowOffhandGrab); if (!canGrab) { continue; } for (int j = 0; j < grabbable.grabPoints.Length; ++j) { Collider grabbableCollider = grabbable.grabPoints[j]; // Store the closest grabbable Vector3 closestPointOnBounds = grabbableCollider.ClosestPointOnBounds(m_gripTransform.position); float grabbableMagSq = (m_gripTransform.position - closestPointOnBounds).sqrMagnitude; if (grabbableMagSq < closestMagSq) { closestMagSq = grabbableMagSq; closestGrabbable = grabbable; closestGrabbableCollider = grabbableCollider; } } } return(closestGrabbable); }
// Update is called once per frame void Update() { //identifies if the inventory is up if (OVRInput.Get(OVRInput.Button.Three) == true) { inventory.SetActive(true); if (objects.Count > 0) { showInvObj(); } } else { inventory.SetActive(false); if (invItem != null) { invItem.SetActive(false); } } //identifies if an object is being held in the right hand if (grabbedObj.grabbedObject != null) { heldObj = grabbedObj.grabbedObject; //Debug.Log(heldObj); heldObj.transform.parent = null; } else { heldObj = null; } }
void OnTriggerExit(Collider otherCollider) { OVRGrabbable grabbable = otherCollider.GetComponent <OVRGrabbable>() ?? otherCollider.GetComponentInParent <OVRGrabbable>(); if (grabbable == null) { return; } // Remove the grabbable int refCount = 0; bool found = m_grabCandidates.TryGetValue(grabbable, out refCount); if (!found) { return; } if (refCount > 1) { m_grabCandidates[grabbable] = refCount - 1; } else { m_grabCandidates.Remove(grabbable); } }
void OnTriggerEnter(Collider otherCollider) { // Get the grab trigger OVRGrabbable grabbable = otherCollider.GetComponent <OVRGrabbable>() ?? otherCollider.GetComponentInParent <OVRGrabbable>(); if (grabbable == null) { return; } // Add the grabbable int refCount = 0; m_grabCandidates.TryGetValue(grabbable, out refCount); m_grabCandidates[grabbable] = refCount + 1; OVRHapticsClip hapticsClip = new OVRHapticsClip(hapticAudioClip); if (m_controller == OVRInput.Controller.LTouch) { OVRHaptics.LeftChannel.Mix(hapticsClip); } else { OVRHaptics.RightChannel.Mix(hapticsClip); } }
void OnTriggerExit(Collider otherCollider) { OVRGrabbable grabbable = otherCollider.GetComponent <OVRGrabbable>() ?? otherCollider.GetComponentInParent <OVRGrabbable>(); if (grabbable == null) { return; } // Remove the grabbable int refCount = 0; bool found = m_grabCandidates.TryGetValue(grabbable, out refCount); if (!found) { //candidatesCount.text = "not found"; return; } if (refCount > 1) { //m_grabCandidates[grabbable] = refCount - 1; m_grabCandidates.Remove(grabbable);//added by luca //candidatesCount.text = "decreased"; } else { m_grabCandidates.Remove(grabbable); //candidatesCount.text = "removed"; } }
public void CatchGrabStartEvent(OVRGrabbable grabbable) { if (attachedTo != null) { DetachFromObject(); } }
// Start is called before the first frame update void Start() { Speaker = GetComponent <AudioSource>(); grab = this.GetComponent <OVRGrabbable>(); Rig = this.GetComponent <Rigidbody>(); }
// Use this for initialization public void Start() { OVRgrab = GetComponent <OVRGrabbable>(); GetComponent <Rigidbody>().useGravity = false; input = GameObject.Find("Starter").GetComponent <SmallSceneInputManager>(); }
IEnumerator disableAlleyObjects() { scene1_sound_manager.EndAllMemorySounds(); foreach (Transform child in alleyObjects.transform) { yield return(new WaitForSeconds(.1f)); if (!child.gameObject.CompareTag("dontEnable")) { StartCoroutine(fadeInAndOut(child.gameObject, false, 2f, true)); } else if (child.gameObject.activeInHierarchy) { OVRGrabbable g = child.GetComponent <OVRGrabbable>(); if (g.isGrabbed) { StartCoroutine(disableAfterGrabEnd(child, g)); } else { child.gameObject.SetActive(false); } } } startEnableBarObjects(); scene1_sound_manager.EndAmbience(); yield return(new WaitForSeconds(0.5f)); scene1_sound_manager.EndPartyTransitionEvent(); }
protected virtual void OffhandGrabbed(OVRGrabbable grabbable) { if (m_grabbedObj == grabbable) { GrabbableRelease(Vector3.zero, Vector3.zero); } }
IEnumerator disableBarObjects() { foreach (Transform child in barObjects.transform) { yield return(new WaitForSeconds(.01f)); if (!child.gameObject.CompareTag("grabbable")) { StartCoroutine(fadeInAndOut(child.gameObject, false, 2f, true)); } else if (child.gameObject.activeInHierarchy) { OVRGrabbable g = child.GetComponent <OVRGrabbable>(); if (g.isGrabbed) { StartCoroutine(disableAfterGrabEnd(child, g)); } else { child.gameObject.SetActive(false); } } } startEnableIslandObjects(); }
public void CatchGrabEndEvent(OVRGrabbable grabbable) { if (overlappingTarget && attachedTo == null) { AttachToObject(overlappingTarget); } }
private void OnTriggerEnter(Collider other) { Renderer mesaRenderer = mesa.GetComponent <Renderer>(); if (other.tag == tag) { Debug.Log("Chocando"); mesaRenderer.material = matRojo; pieza = other.transform.parent.gameObject; pieza.transform.parent = padre.transform; /*Vector3 distancia = pieza.transform.position - padre.transform.position; * Debug.Log("Posicion Base:" + padre.transform.position); * Debug.Log("Posicion Pieza:" + pieza.transform.position); * Debug.Log("Distancia:" + distancia); * Collider caja = padre.GetComponent<Collider>(); * * pieza.transform.position = pieza.transform.position - distancia + caja.bounds.size; */ OVRGrabbable script = pieza.GetComponent <OVRGrabbable>(); Destroy(script); Base comportamiento = padre.GetComponent <Base>(); comportamiento.AñadirPieza(); Destroy(this); } else { mesaRenderer.material = matAzul; } }
void OnTriggerEnter(Collider other) { if (other.transform.root.GetComponent <Placeable>() == null) { return; } Rigidbody body = other.transform.root.GetComponent <Rigidbody>(); body.position = (transform.position); body.rotation = (transform.rotation); body.isKinematic = true; OVRGrabbable grabbable = other.transform.root.GetComponent <OVRGrabbable>(); if (grabbable != null) { OVRGrabber grabber = grabbable.grabbedBy; if (grabber != null) { grabber.ForceRelease(grabbable); } } if (OnPlacematEnter != null) { OnPlacematEnter(other.transform.root.gameObject); } }
// Start is called before the first frame update void Start() { grabbable = GetComponent <OVRGrabbable>(); attractor = GetComponent <Attractor>(); grabbable.OnGrabBegin += Grabbable_OnGrabBegin; grabbable.OnGrabEnd += Grabbable_OnGrabEnd; }
new private void Start() { base.Start(); toggleStick = this.transform.Find("Scene").Find("Sphere.003").gameObject; toggleHandle = this.transform.Find("ToggleHandle(Clone)").gameObject; defaultHandlePos = new Vector3(0, 0.01f, 0); grab = toggleHandle.GetComponent <OVRGrabbable>(); }
protected void GrabbableRelease(OVRGrabbable grabbable, Vector3 linearVelocity, Vector3 angularVelocity) { grabbable.GrabEnd(linearVelocity, angularVelocity); if (m_parentHeldObject) { grabbable.transform.parent = null; } }
private void Awake() { //[TODO]Getting the info of OVRGrabbable grabState = GetComponent <OVRGrabbable>(); bladeIsActivated = false; quillonIsInstalled = false; powerIsInstalled = false; }
// Start is called before the first frame update void Start() { _OVRGrabbable = this.GetComponent <OVRGrabbable>(); for (int i = 0; i < 5; i++) { _ypos.Add(0); } }
protected void Start() { state = InteractibleState.New; rb = GetComponent <Rigidbody>(); grabbable = GetComponent <OVRGrabbable>(); ovrInputController = OVRInput.Controller.None; appear.Invoke(); }
// Use this for initialization void Start() { //-- Gets the original starting position of the stem --// newLeafPos = leaf.transform.position; oldLeafPos = newLeafPos; grabbableSource = grablink.GetComponent <OVRGrabbable>(); }
// Use this for initialization void Start() { //meshRenderer = GetComponent<MeshRenderer>(); ovrGrabbable = GetComponent <OVRGrabbable>(); initransform = transform.localScale; text = GetComponentInChildren <TextMesh>(); }
protected void GrabbableRelease(Vector3 linearVelocity, Vector3 angularVelocity) { m_grabbedObj.GrabEnd(linearVelocity, angularVelocity); if (m_parentHeldObject) { m_grabbedObj.transform.parent = null; } m_grabbedObj = null; }
public void ForceRelease(OVRGrabbable grabbable) { bool flag = this.m_grabbedObj != null && this.m_grabbedObj == grabbable; if (flag) { this.GrabEnd(); } }
void Start() { built = false; grabbable = GetComponent <OVRGrabbable>(); if (autoBuild) { Build(); } }