private void SpawnArrow(HandGrabber grabber) { VrConsole.Log("Arrow spawning."); // TODO: // object pooling for arrows var _arrow = Instantiate(arrowPrefab); grabber.heldObject = _arrow; _arrow.transform.parent = grabber.grabPoint; _arrow.transform.localPosition = Vector3.zero; _arrow.transform.localRotation = Quaternion.identity; }
private void Start() { try { var _localPlayerItems = FindObjectsOfType <AvatarItemLink>(); leftHandModel = _localPlayerItems.Where(x => x.AvatarItem == AvatarItemLink.AvatarItems.LeftHand).First().GetModel; leftHandGrabber = _localPlayerItems.Where(x => x.AvatarItem == AvatarItemLink.AvatarItems.LeftHand).First().gameObject.GetComponentInChildren <HandGrabber>(); rightHandModel = _localPlayerItems.Where(x => x.AvatarItem == AvatarItemLink.AvatarItems.RightHand).First().GetModel; rightHandGrabber = _localPlayerItems.Where(x => x.AvatarItem == AvatarItemLink.AvatarItems.RightHand).First().gameObject.GetComponentInChildren <HandGrabber>(); leftHandModel.SetActive(false); rightHandModel.SetActive(false); leftHandGrabber.heldObject = bowObject; bowTransform.parent = leftHandGrabber.grabPoint; bowTransform.localPosition = Vector3.zero; bowTransform.localRotation = Quaternion.identity; } catch (Exception ex) { Debug.LogError("Local player transforms not set properly: " + ex, this); } }