Shouldn't use transform.TransformDirection() in XRGrabInteractable.GetWorldAttachPosition()

version 2.0.1

If turn off TrackRotation, the XRGrabInteractable will work weird.

see Line 535 in XRGrabInteractable.cs:

return interactorAttachTransform.position + transform.TransformDirection(m_InteractorLocalPosition);

Shouldn’t use transform.TransformDirection(m_InteractorLocalPosition) here because m_InteractorLocalPosition is not related to transform, using transform here is meaningless.

The correction is to replace transform.TransformDirection(m_InteractorLocalPosition) with GetAttatchTransform(interactor).TransformDirection(m_InteractorLocalPosition).

The whole method should be corrected like below:

Vector3 GetWorldAttachPosition(IXRInteractor interactor)
{
           var interactorAttachTransform = interactor.GetAttachTransform(this);

           if (!m_TrackRotation)
               return interactorAttachTransform.position +
GetAttatchTransform(interactor).TransformDirection(m_InteractorLocalPosition);
// the following is replaced: transform.TransformDirection(m_InteractorLocalPosition);

           return interactorAttachTransform.position + interactorAttachTransform.rotation * m_InteractorLocalPosition;
}

Kind of funny.

They split it into two bugs: Unity Issue Tracker - [XRI] XRGrabInteractable moves to controller when Collider size or position differs from the Transform and Force Grab is off
Unity Issue Tracker - [XR Interaction Toolkit] XR Grab Interactable does not point to Attach Transform Game object when Track Rotation is set to false

I gave up on using this framework, because I don’t like wasting time.

yes, this framework is not well documented and not well demostrated, Using it needs to deeg into source. However i hope it will be developed better and better.