void Start() { rb = GetComponent <Rigidbody>(); grabsInTrigger = GetComponent <GrabbablesInTrigger>(); joint = GetComponent <ConfigurableJoint>(); input = InputBridge.Instance; // Setup defaults if (joint == null) { joint = gameObject.AddComponent <ConfigurableJoint>(); joint.rotationDriveMode = RotationDriveMode.Slerp; JointDrive slerpDrive = joint.slerpDrive; slerpDrive.positionSpring = 600; JointDrive xDrive = joint.xDrive; xDrive.positionSpring = 2500; JointDrive yDrive = joint.yDrive; yDrive.positionSpring = 2500; JointDrive zDrive = joint.zDrive; zDrive.positionSpring = 2500; } if (HandsGraphics) { handsGraphicsParent = HandsGraphics.transform.parent; handsGraphicsPosition = HandsGraphics.transform.localPosition; handsGraphicsRotation = HandsGraphics.transform.localRotation; //handsGraphicsGrabberOffset = HandsGraphics.position - transform.position; handsGraphicsGrabberOffset = transform.InverseTransformPoint(HandsGraphics.position); handsGraphicsGrabberOffsetRotation = transform.localEulerAngles; } // Make Collision Dynamic so we don't miss any collisions if (rb && rb.isKinematic) { rb.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative; } // Should we auto equip an item if (EquipGrabbableOnStart != null) { GrabGrabbable(EquipGrabbableOnStart); } // Velocity Tracking if (velocityTracker == null) { velocityTracker = GetComponent <VelocityTracker>(); } // Add Velocity Tracker if one was not provided if (velocityTracker == null) { velocityTracker = gameObject.AddComponent <VelocityTracker>(); velocityTracker.controllerHand = HandSide; } }
void requestOwnerShipForNearbyGrabbables(GrabbablesInTrigger grabbables) { if (grabbables == null) { return; } // In Hand foreach (var grab in grabbables.NearbyGrabbables) { PhotonView view = grab.Value.GetComponent <PhotonView>(); if (view != null && RecentlyRequested(view) == false && !view.AmOwner) { RequestGrabbableOwnership(view); } } // Remote Grabbables foreach (var grab in grabbables.ValidRemoteGrabbables) { PhotonView view = grab.Value.GetComponent <PhotonView>(); if (view != null && RecentlyRequested(view) == false && !view.AmOwner) { RequestGrabbableOwnership(view); } } }
void Start() { LeftGrabber = GameObject.Find("LeftController").GetComponentInChildren <Grabber>(); gitLeft = LeftGrabber.GetComponent <GrabbablesInTrigger>(); RightGrabber = GameObject.Find("RightController").GetComponentInChildren <Grabber>(); gitRight = RightGrabber.GetComponent <GrabbablesInTrigger>(); requestedGrabbables = new Dictionary <int, double>(); }
// Start is called before the first frame update void Start() { gZone = GetComponent <GrabbablesInTrigger>(); // Auto Equip item if (HeldItem != null) { GrabGrabbable(HeldItem); } }
void Start() { rb = GetComponent <Rigidbody>(); grabsInTrigger = GetComponent <GrabbablesInTrigger>(); joint = GetComponent <ConfigurableJoint>(); // Setup defaults if (joint == null) { joint = gameObject.AddComponent <ConfigurableJoint>(); joint.rotationDriveMode = RotationDriveMode.Slerp; JointDrive slerpDrive = joint.slerpDrive; slerpDrive.positionSpring = 600; JointDrive xDrive = joint.xDrive; xDrive.positionSpring = 2500; JointDrive yDrive = joint.yDrive; yDrive.positionSpring = 2500; JointDrive zDrive = joint.zDrive; zDrive.positionSpring = 2500; } // Look for input from Player if (GameObject.FindGameObjectWithTag("Player")) { input = GameObject.FindGameObjectWithTag("Player").GetComponent <InputBridge>(); } if (HandsGraphics) { handsGraphicsParent = HandsGraphics.transform.parent; handsGraphicsPosition = HandsGraphics.transform.localPosition; handsGraphicsRotation = HandsGraphics.transform.localRotation; } playSpace = GameObject.Find("TrackingSpace"); previousVelocities = new List <Vector3>(); previousAngularVelocities = new List <Vector3>(); // Make Collision Dynamic so we don't miss any collisions if (rb && rb.isKinematic) { rb.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative; } // Should we auto equip an item if (EquipGrabbableOnStart != null) { GrabGrabbable(EquipGrabbableOnStart); } }
private void GetReferences() { gZone = GetComponent <GrabbablesInTrigger>(); snapConditions = GetComponents <ISnapCondition>(); unsnapConditions = GetComponents <IUnSnapCondition>(); }
void Start() { ringCanvas = GetComponent <CanvasScaler>(); ringText = GetComponent <Text>(); nearbyGrabbables = Snap.GetComponent <GrabbablesInTrigger>(); }