public virtual void Ungrab(Grabber.GrabInfo grabberInfo) { var matches = grabbers.Where(grabber => grabber.info == grabberInfo); bool isCurrentlyGrabber = matches.Count() > 0; if (isCurrentlyGrabber) { Ungrab(matches.First()); } }
public virtual LocalInfo CreateLocalInfo(Grabber.GrabInfo grabInfo, float maxForce) { var localInfo = new LocalInfo() { info = grabInfo, localPosition = grabInfo.parent.InverseTransformPoint(transform.position), localRotation = grabInfo.parent.InverseTransformRotation(transform.rotation), maxForce = maxForce }; return(localInfo); }
public virtual bool GetLocalInfo(Grabber.GrabInfo grabInfo, out LocalInfo localInfo) { var matches = grabbers.Where(grabber => grabber.info == grabInfo); bool isCurrentlyGrabber = matches.Count() > 0; if (isCurrentlyGrabber) { localInfo = matches.First(); } else { localInfo = default; } return(isCurrentlyGrabber); }
public virtual void Grab(Grabber.GrabInfo grabberInfo, float maxForce) { Grab(CreateLocalInfo(grabberInfo, maxForce)); }