Search Unity

XR Interaction Toolkit - Absolutely cannot make a custom pivot point for grabbing items!

Discussion in 'VR' started by goddestroyer, May 3, 2020.

  1. goddestroyer

    goddestroyer

    Joined:
    Jan 11, 2017
    Posts:
    12
    I'm using XR Interaction Toolkit XR Grab Interactable to pick up items in a basic scene.

    Goal: the alignment of the items when held in the hand line up in a natural way that you would hold the same item in real life.

    Actual behavior: no matter how i parent-child the grabbable and mesh, the grabbable position is always defaulting to the center of the object (although the in-hand rotation does hold correctly).

    My meshes themselves do not have pivot points that are matched up to the desired in-hand orientations. Here is the pivot point as imported of the purple suitcase mesh:


    no problem (i thought) I'll create a parent transform with the grabbable component, and then child the mesh with the correct in-hand orientation. In the case of the purple suitcase, you should grab it by the suitcase handle, so i've done that as shown here:


    However, that's only working for in-hand rotation, while the item is always being gripped by the center of the item rather than by the pivot point i've defined.

    Here is a second item I repeated the same process for as the suitcase:

    Original mesh transform:


    Parent Grabbable item transform (so that you hold the book by it's bottom right corner, slightly tiled away from you:


    The video below shows these objects being grabbed, and you can see in all cases, the objects are grabbed by the center, not using EITHER the child nor parent pivot points.

    please help!


     
  2. LM031

    LM031

    Joined:
    Jul 16, 2017
    Posts:
    10
    Just recently started with this also., using XRIT 0.94

    How I do it is to attach a child object (empty gameobject) to the object you want to grab. This child object you position/rotate where you want to pick up the object. That object you drag to the field in the "Attach Transform" of the XR Grab Interactable (the one attached to the object to be picked up). Then it should work. Note this child object only needs a transform, nothing else is required.
    When positioning this child object, I use a mesh renderer to have a bettter visual reference, which I delete/hide when I set the proper position)

    I also noticed that using the movement types instantaneous or velocity tracking often it ignores the attach object and grabs at the center of the object. So best to start of with Kinematicc for "Movement Type". Not found the reason for this different behaviour
     
    Last edited: May 3, 2020
    Pea899, InsaneDuane and goddestroyer like this.
  3. goddestroyer

    goddestroyer

    Joined:
    Jan 11, 2017
    Posts:
    12
    OMFG this works perfectly, after spending so many hours trying different combinations of parent-childing! thank you! I noticed that field while working with this stuff but i dont see it clearly documented in the documentation and the language "attach transform" didn't jump out at me as being what I needed. I do get a brief explanation of the field now that i hover over it in the editor. if it was more like "attach transform for in-hand grabbing position" it would have been perfectly clear to me. thanks again
     
  4. goddestroyer

    goddestroyer

    Joined:
    Jan 11, 2017
    Posts:
    12
    With the attaching point solved, I have a great workflow pro-tip for anyone who finds this thread:

    - create the empty child transform on your grabbable object to be the "attach transform"
    - child a controller model prefab under the attach transform (in my case it's Oculus Go)
    - position and rotate your "attach transform" so you can visually see how the object will sit in the hand relative to the controller
    - disable the controller models in the scene before building

    *also note: pay special attention to your global/local and pivot/center settings.
     
    raynorzs, elewint and hookmanuk like this.
  5. LM031

    LM031

    Joined:
    Jul 16, 2017
    Posts:
    10
    Yeah, it sometimes slow going. A tip of mine, check out the youtube channels from Valem and the one from Andrew. The content from them (I have no connection to them) has helped me already a lot.
     
    elewint, InsaneDuane and goddestroyer like this.
  6. RRBeechPhoto

    RRBeechPhoto

    Joined:
    May 19, 2021
    Posts:
    3
    Thank you for all the helpful hints posted here. This saved me a lot of time.