// Update is called once per frame void Update() { if (go) { RaycastHit[] hit = Physics.RaycastAll(this.transform.position, this.transform.forward, 1.3f); for (int i = 0; i < hit.Length; i++) { if (hit[i].rigidbody != null) { hit[i].rigidbody.AddForce(this.transform.forward * force, ForceMode.Impulse); Explo e = hit[i].transform.GetComponent <Explo> (); if (e != null) { e.Activate(); } } } } if (interact) { munition = Physics.RaycastAll(this.transform.position, this.transform.forward, 1.3f); } }
// Use this for initialization void Start() { i = GetComponent <NewtonVR.NVRInteractableItem> (); r = GetComponent <Rigidbody> (); e = GetComponent <Explo> (); }