public void AttachUser(IAnchorUser _user) { m_anchor.connectedBody = _user.GetRigidbody2D(); Vector2 dir = (Vector2)transform.position - m_anchor.connectedBody.position; m_anchor.connectedBody.AddForce(dir * 50f); m_anchor.distance -= 0.5f; m_lineRenderer.enabled = true; }
public void AttachToNearestAnchor(IAnchorUser _anchorUser) { AnchorComponent nearestAnchor = FindNearestAnchorComponent(_anchorUser.GetRigidbody2D().transform.position); if (nearestAnchor != null) { nearestAnchor.AttachUser(_anchorUser); } else { Debug.LogWarning("No anchors found to attach the body"); } }
public bool IsAttachedToUser(IAnchorUser _user) { return(m_anchor.connectedBody == _user.GetRigidbody2D()); }
public void AttachUser(IAnchorUser _user) { m_anchor.connectedBody = _user.GetRigidbody2D(); m_lineRenderer.enabled = true; }