https://pastie.io/rlsfnj.cshttps://pastie.io/rlsfnj.cs link no longer working
Edit:
Here's a Github repository I'm making with the same scripts https://github.com/richardmuthwill/UnityMirrorXR
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack Internalhttps://pastie.io/rlsfnj.cshttps://pastie.io/rlsfnj.cs link no longer working
Edit:
Here's a Github repository I'm making with the same scripts https://github.com/richardmuthwill/UnityMirrorXR
https://pastie.io/rlsfnj.cs link no longer working
Edit:
Here's a Github repository I'm making with the same scripts https://github.com/richardmuthwill/UnityMirrorXR
I have currently created a workaround but to be honest I'm not sure if this will break other aspects of the grab system. I got this working by disabling the reparenting of the object (with a bool) in the Grab() and Drop() methods in the XR Grab Interactable script.
I copied the file XRGrabInteractable.cs from the XR Interaction Toolkit and added a new boolean called changeTransformParent
[SerializeField] bool m_ChangeTransformParent = true; /// <summary> /// Whether to set the parent of this object when this object is grabbed /// </summary> public bool changeTransformParent { get => m_ChangeTransformParent; set => m_ChangeTransformParent = value; } And here are the Grab() and Drop() methods after adding the bool
/// <summary> /// Updates the state of the object due to being grabbed. /// Automatically called when entering the Select state. /// </summary> /// <seealso cref="Drop"/> protected void Grab() { m_OriginalSceneParent = transform.parent; if (m_ChangeTransformParent) transform.SetParent(null); // Special case where the interactor will override this objects movement type (used for Sockets and other absolute interactors) m_CurrentMovementType = selectingInteractor.selectedInteractableMovementTypeOverride ?? m_MovementType; SetupRigidbodyGrab(m_Rigidbody); // Reset detach velocities m_DetachVelocity = Vector3.zero; m_DetachAngularVelocity = Vector3.zero; // Initialize target pose for easing and smoothing m_TargetWorldPosition = m_AttachPointCompatibilityMode == AttachPointCompatibilityMode.Default ? transform.position : m_Rigidbody.worldCenterOfMass; m_TargetWorldRotation = transform.rotation; m_CurrentAttachEaseTime = 0f; UpdateInteractorLocalPose(selectingInteractor); SmoothVelocityStart(); } /// <summary> /// Updates the state of the object due to being dropped and schedule to finish the detach during the end of the frame. /// Automatically called when exiting the Select state. /// </summary> /// <seealso cref="Detach"/> /// <seealso cref="Grab"/> protected void Drop() { if (m_RetainTransformParent && m_OriginalSceneParent != null && !m_OriginalSceneParent.gameObject.activeInHierarchy && m_ChangeTransformParent) { bool exitingPlayMode; #if UNITY_EDITOR // Suppress the warning when exiting Play mode to avoid confusing the user exitingPlayMode = UnityEditor.EditorApplication.isPlaying && !UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode; #else exitingPlayMode = false; #endif if (!exitingPlayMode) Debug.LogWarning("Retain Transform Parent is set to true, and has a non-null Original Scene Parent. " + "However, the old parent is deactivated so we are choosing not to re-parent upon dropping.", this); } else if (m_RetainTransformParent && gameObject.activeInHierarchy && m_ChangeTransformParent) transform.SetParent(m_OriginalSceneParent); SetupRigidbodyDrop(m_Rigidbody); m_CurrentMovementType = m_MovementType; m_DetachInLateUpdate = true; SmoothVelocityEnd(); } Here is the full script - please note this for the specific version: 1.0.0-pre.5
TLDR; This is a hack of the original file
XRGrabInteractable.csand might break other things