Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Daar375 · Mar 29 at 09:52 PM · beginnerbug-perhaps

XR Interaction Toolkit Two Hand Grab and XRSocketInteractor Erros

I am working on a VR app, this app uses the XR interaction toolkit, i am trying to implement the Two hand grab on a object, this works fine but whenever i put the object on the socket, it has a big offset with the attach transform, this only happens when using both the Two hand Grab and the XRSocketInteractor, using the normal XRGrabInteractable works fine with the same sockets. The code i am using is a slight modification of the code on this video https://www.youtube.com/watch?v=Ie0-oKN3Lq0&t, my modifications are not the issue as the error happens even when using the original code.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Daar375 · Mar 29 at 09:57 PM

The code of the TwoHandGrabInteractable, the modifications i made are for another bug in the interaction with the socket, even without them the same offset is happening

 public class TwoHandGrabInteractable : XRGrabInteractable
 {
     [SerializeField]
     private List<XRSimpleInteractable> secondHandGrabPoints = new List<XRSimpleInteractable>();
 
     public  XRBaseInteractor secondInteractor;
     // Start is called before the first frame update
    void Start()
     {
         foreach (var item in secondHandGrabPoints)
         {
             item.onSelectEnter.AddListener(OnSecondHandGrab);
             item.onSelectExit.AddListener(OnSecondHandRelease);
         } 
     }

     public override void ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase updatePhase)
     {
         
         if(secondInteractor && selectingInteractor)
         {
             selectingInteractor.attachTransform.rotation = Quaternion.LookRotation(secondInteractor.attachTransform.position - selectingInteractor.attachTransform.position, selectingInteractor.transform.up);
         }
         base.ProcessInteractable(updatePhase);
     }
     public void OnSecondHandGrab(XRBaseInteractor interactor)
     {
         if (selectingInteractor) 
         if (selectingInteractor.gameObject.tag != "socket")
         {
             secondInteractor = interactor;
 
         }
 
 
     }
     public void OnSecondHandRelease(XRBaseInteractor interactor)
     {
 
        secondInteractor = null;
 
     }
 
     protected override void OnSelectEnter(XRBaseInteractor interactor)
     {
 
 
         base.OnSelectEnter(interactor);
 
     }
     protected override void OnSelectExit(XRBaseInteractor interactor)
     {
 
         base.OnSelectExit(interactor);
         secondInteractor = null;
     }
     public override bool IsSelectableBy(XRBaseInteractor interactor)
     {
 
         bool isAlreadygrab = (selectingInteractor && !interactor.Equals(selectingInteractor)) ;
 
         if (selectingInteractor)
         {
 
             if (selectingInteractor.gameObject.tag == "socket" && interactor.gameObject.tag == "Hand")
             {
                 selectingInteractor.gameObject.GetComponent<XRSocketInteractor>().socketActive = false;
                 secondInteractor = null;
 
                 isAlreadygrab = false;
 
             }
  
         }
 
 
         return base.IsSelectableBy(interactor) && !isAlreadygrab;
         
     }
 }
 
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

193 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to stop player from going flying into the air when on diagonal platform? 0 Answers

Help! On/off button 1 Answer

Simple Movement Script Broken 1 Answer

How can I change my player control method to use a touch screen ?? Pong-clone 2D 0 Answers

Absolute beginner. What do I need to know? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges