Search Unity

Question Cube misformed after grab

Discussion in 'XR Interaction Toolkit and Input' started by Bender_R, Mar 18, 2023.

  1. Bender_R

    Bender_R

    Joined:
    May 21, 2018
    Posts:
    115
    Hi there,

    I'm 99% sure that this is a very nooby question, but since I can't seem to find the setting that's causing this, I just decided to post it anyway.

    I have a cube with XR Grab Interactable on it. When grabbing (XR Rig), the cube get's misformed. Any ideas?

    See: https://ibb.co/ryHjRbS

    Thanks!!
    -Bender
     
  2. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    Check your transform hierarchy. Some transform probably has a non uniform scale (meaning that scale x,y,z are not all equal). As a rule of thumb I would recommend that you keep all transform scale == Vector3.one and only scale the actual visual object to whatever you need. Then, add an empty transform as a sibling of the visual object to where you can parent grabbed objects without the need to mess with the scale
     
    Bender_R likes this.
  3. katanant

    katanant

    Joined:
    Jul 16, 2022
    Posts:
    10
    Hi, I have the same problem, yes it was a problem of non-uniform axes, in my case I solved it by setting only the collider (in my case a capsule) of the player to the desired height hiding the actual mesh leaving it at 1.1 ,1 and always moving the "camera look" to the same height, now being a total beginner I would like to know one thing....my test game is in first person and the player is actually hidden....but just in case in which I need a player with its mesh visible and the axes are not uniform as in the case of a human figure for example, how can I avoid the problem of deformation of the object taken on the Y axis?
    Sorry in advance if my English is not perfect...
     
  4. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    A scale of (1,1,1) does not mean that the actual dimensions of whatever object you’re applying it to will look like a box. Models have their intrinsic size and keep said intrinsic size if the scale is (1,1,1).

    That said, if you add a humanoid character model, you’ll want to keep the scale at (1,1,1) or at least uniform so „it looks right”. Don’t worry too much about it until you add an actual character model.. everything will make sense then :)
     
    katanant likes this.
  5. katanant

    katanant

    Joined:
    Jul 16, 2022
    Posts:
    10
    hello, thank you very much for the answer, eh I still don't know many things :D
     
  6. Bender_R

    Bender_R

    Joined:
    May 21, 2018
    Posts:
    115
    Thanks a lot! Removing parent did the trick.
     
    VRDave_Unity likes this.
  7. LINGLUOSY

    LINGLUOSY

    Joined:
    Nov 10, 2022
    Posts:
    1
    Hi,
    I have the same problem and I found out that if all the parents are scale (1,1,1), the problem would be solve. The object with the component XR Grab Interactable don't have to be scale (1,1,1). The misformed thing is actually mesh, not the object. I still wonder the cause of this problem, let me know if anyone know the answer, thanks
     
    VRDave_Unity likes this.