Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Moving while holding an object (XR Grab Interactable)

Discussion in 'XR Interaction Toolkit and Input' started by Tu6Rob, May 7, 2022.

  1. Tu6Rob

    Tu6Rob

    Joined:
    Apr 2, 2022
    Posts:
    1
    Hi everyone,
    first of all apologise if this topic has been already explored. I tried to search for a similar topic but I couldn't find it.
    I am trying to make intractable objects in my scene using XR grab. For the sake of clarity, my intractable objects uses the following components: mesh renderer, Box collider, Rigidbody, XR Grab Interactable.
    Right now I have two problems with that.
    1. Simple 3D objects (e.g. cubes) can be grabbed. However that seems to mess up my locomotion system. Some time while I try to move forward while holding the cube, my camera is suddenly moved to the backward-left (the movements are sudden as a sort of teleport).
    2. When I try to apply the same setup to an object I created in blender (OBJ group with .obj extension) the object disappear. I tried to apply the setup to only one of the component but in that case that specific component becomes invisible. Admittedly, I don't have a mesh renderer for this type of objects.
    I hope someone can help with the above.
     
  2. kej-unity

    kej-unity

    Unity Technologies

    Joined:
    Jun 28, 2019
    Posts:
    5
    Hi @Tu6Rob, I can help the first problem. By default we don't ignore the collision for
    XRGrabInteractable
    GameObject so when it is grabbed by the player, it can collide with any colliders on the player, especially when during the locomotion. I assume your player GameObject has a collider like a capsule collider or the
    CharacterController
    component on it.

    There are two ways you can avoid that unintended collision. One is to add the
    XRGrabInteractable
    to a layer which does not intersect with the player until released from the player's grip. Another potential solution is to use Physics.IgnoreCollison to exclude colliders from hitting the player's collider. I discussed this issue with more details in earlier forum posts. You might want to take a look:

    https://forum.unity.com/threads/user-collision-and-grabbable-objects.1176392/
    https://forum.unity.com/threads/gra...-with-locomotion-system.1258443/#post-8024459

    For your second problem I don't have a clear idea on which component went invisible and the setup, so if you can share more information we can dig more to it. It may also have to do with exporting and importing the 3D model.
     
  3. KaroSandel

    KaroSandel

    Joined:
    Dec 5, 2022
    Posts:
    1
    Hi @Tu6Rob
    I have this same problem. If you managed to solve it, please help me.
    1. When I try to apply the same setup to an object I created in blender (OBJ group with .obj extension) the object disappear. I tried to apply the setup to only one of the component but in that case that specific component becomes invisible. Admittedly, I don't have a mesh renderer for this type of objects.
     
    rhiskey likes this.