How can I make my VR controller stick to a virtual Joystick and still control it?
Hey guys,
I'm trying to build a VR joystick which could be used to control whatever. I'm using VRTK the framework and a custom hand controller which actually works quite well. I used a Configurable Joint to stick the joystick to the surface and make it move the right way and the VRTK_InteractableObject script to make it, well, interactable. The problem I have now is, that I want the model of the hand to stick to the joystick as long as the grab button on the physical controller is pressed and still take input from the controllers movements. I've seen this in games like Lone Echo. In this basic version, you can pull away your hand while still grabbing and at a certain point it starts to glitch out even though I set the break force and torque for the joint between the joystick and the table to infinite. I then tried to write my own subclass of the VRTK_BaseGrabAttach script that just attaches the hand model to the top of the controller as long as the grab button is pressed, but as soon as I do that, my joystick won't move with the controller input anymore even though the parent GameObject with all the actual controller scripts stays at the same place within the logical structure. You can still move your now invisible hand (you know it's there because the joystick still reacts to colliding with it) but it's not logically attached to the joystick anymore. It also doesn't call the usual events and methods it would when a grab ends. These get called once I release the physical button and the hand model snaps back onto my controller. Is that even the right way to go about it? Can somebody give me some pointers on how to achieve what I set out to do? If you need more information or something I will gladly provide. Thank you for your time!
Answer by pithakoteTata · Mar 09, 2020 at 12:38 PM
Hello @mbrenner1406 ,
I have been looking into this as well, are you able to find a solution for this?
I saw this blog, maybe this might help: http://www.luispedrofonseca.com/unity-vr-joystick/
Please let me know if you have been able to do so, i could use some help as well.
Your answer
Follow this Question
Related Questions
Programming Touchpad Joystick on Oculus Go 0 Answers
Vector3 from another objects rotation 1 Answer
Need help with Socket Interactor 0 Answers