Search Unity

Question Two Handed Grab Movement like Horizon Worlds Creation Mode or Gravity Sketch

Discussion in 'XR Interaction Toolkit and Input' started by irvinh, Mar 20, 2023.

  1. irvinh

    irvinh

    Joined:
    Mar 26, 2020
    Posts:
    1
    Hi,

    Looking for advice on how to get two handed grab movement behaviors similar to that of Horizon Worlds when you're in edit mode or like in Gravity Sketch. I've tried XR Interaction Toolkit's (XRIT) TwoHandedGrabMoveProvider, but the two main differences are

    1) with rotation using XRIT's solution you rotate "in place" while in Horizon Worlds/Gravity sketch it's more like you're rotating the scene and everything in it (including yourself) with your hands fixed in the scene where they're grabbing.

    2) with scaling for XRIT the absolute camera height position changes as you scale where as with Horizon Worlds/Gravity the camera is fixed while the world scales around you.

    I've been able to create a behavior similar to Gravity Sketch/Horizon Worlds for scaling where as the XR Origin scales I adjust it's position based on the change in camera position, but I'm struggling to get the rotation behavior right. I've tried using Transform.RotateAround and Transform.LookAt in various combinations without luck and it seems like I can do something similar with how I approached scaling where I look at the change in position of the hands and then reset the hands to be fixed and move the head based on the difference, but I haven't quite got the math right and I'm not sure if that's how I should be approaching it.

    The other thing is it seems like scale/rotation/position can all be tackled uniformly (instead of handling scaling as a separate case from rotation etc) by attaching everything in the scene to an object that the hands grab and move/rotate/scale, but that seems not ideal for some reason (but maybe it's fine?).

    Thanks for any help!
     
    Last edited: Mar 20, 2023