//--------------------------------------------------------------------------- ARM RAYCAST PINNING: User selecting where to place the closest arm of the selected body on a body surface through raycasting public void ArmRaycastPin_Begin() { _oHandTarget = _oHandTarget_RaycastPin; _oHandTarget.ConnectHandToHandTarget(this); _oHandTarget.transform.position = _oJointExtremity.transform.position; // Manually set the hand target position to the hand position so slerp in Update doesn't start from some old stale position ###MOVE? _oBodyArmPin = null; //_nArmPinBodyColVert = -1; //_nTimeStartPinSet = 0; // Reset our start-of-slerp time to zero so it's initialize at first real pin position //_bPinByClosestVert = false; // We start pinning by ray position as it's much more accurate. When user releases pinning key we go to vert pinning which will handle changes in body orientation ###IMPROVE: Always have 'ray precision' pinning by storing offset and rotating to closest vert normal? _oConfJoint_Extremity.angularXMotion = _oConfJoint_Extremity.angularYMotion = _oConfJoint_Extremity.angularZMotion = ConfigurableJointMotion.Free; // We free rotation constraint so hand is just attraced by position (and repelled by colliders) Greatly simplifies hand raycasting!! }