Search Unity

Question How to make XRGrabInteractables grabbed position move towards grabbed position?

Discussion in 'XR Interaction Toolkit and Input' started by Jawsarn, Mar 11, 2023.

  1. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    245
    I noticed that the XRGrabInteractable modes of moving moves the object form perspective of the transform and not by applying forces between grabbed area. This cause issues when you're e.g. using joints and the center of gravity is on the other side of the joint compared to where you grabbed.

    upload_2023-3-12_0-10-59.png

    Where if you do this with Velocity Mode the object will be flipped.

    I'm considering what I can do to fix this issue for now? The whole XRGrabInteractable has nothing really exposed to be extended to that leaves only to copy the whole package, as it also relies on the Grab Transformers that are tightly coupled.

    My only other option that I can think of would be to have a grab interactable middle man that puts forces on the object correctly.
     
  2. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    245
    Tried the middle man approach and it had its own bucket of issues, unstable joint etc, as you will need to add a scaled up force to counteract the joints interaction, else it will slowly move to the grab position. My new solution is to keep the center of mass by the grab side of the joint and disable rigidbody gravity while adding a custom gravity force in my "wanted" center of mass.