Search Unity

Question Interacting with a hinge joint in AR

Discussion in 'AR' started by devikasantosh, Jun 3, 2023.

  1. devikasantosh

    devikasantosh

    Joined:
    Jul 25, 2022
    Posts:
    6
    Hey,
    I am trying to build interactable furniture and appliances, and I've made a shelf with a door on Unity. I've added a hinge joint to the door, set limits, and added a spring. I'm pretty happy with the physics when I rotate the door in game mode.
    However, I don't know how to do the same in AR.
    So far I have:
    1. tried creating a rotation script to add to the door (makes the door motion very erratic)
    2. used another object with translation to move the door (cannot close the door back once it is opened)
    3. tried using grab interactables in VR
    4. added Lean Touch to rotate the entire shelf in general (but cannot rotate just the door without messing up everything again)
    but nothing seemed to be working the way I saw in game mode on unity itself.
    Does anyone have any tips for beginners regarding AR rotation on a hinge joint to move a door?
    I'm a beginner, and I am not very well versed in my basics, I just know a lot of random things, so please be kind.
    (if there is any way to use lean touch to rotate the door with one finger, but the entire shelf with 2 fingers, that would be the best i feel! currently, the door and the rest of the shelves both have a common parent object too)

    Thank you!
     
    Last edited: Jun 4, 2023
    makaka-org likes this.
  2. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    1,023
    1. What is your AR Engine?
    2. Which Tracking Technology do you use? Plane Tracking, Image Tracking...?

    Can you provide a video example of working in the Editor, and how it works in AR (to understand the bugs visually)? it's not entirely clear what your problem is.

    Does your example work on mobile build without AR? Test it.

    I have no experience with a door, but I have it with the basketball hoop / ring (Hinge Joint) for AR Foundation and Plane Tracking.

    I remember that there were some problems with the Hinge Joint while developing for Vuforia and Image Tracking, I guess so... Possibly, it was related to "static properties" of game object...

    But with the AR Foundation and Plane Tracking, there didn't seem to be any problems.

    These are my settings for that (if it can help in any way).
    It works like a charm on Mobiles as well as on Desktop and WebGL.

    Screenshot 2023-06-08 at 16.36.05.png Screenshot 2023-06-08 at 16.36.14.png
     
  3. devikasantosh

    devikasantosh

    Joined:
    Jul 25, 2022
    Posts:
    6
    Thank you so much!! I'm using Unity with Vuforia image targets.
    I added a few random changes, like making the mass of the shelf super high, and the door really light, so they don't both move together. I also used a plugin to move the pivot point of the door to where the hinge actually is. Haven't tested them out yet, but I feel they'll work! My project doesn't require the touch and drag feature anymore, I'll be doing it with a button click and an animation, so I haven't tried it yet.

    Thank you for the detailed explanation and the example! Helped me a lot :D