In-Game Physical Joystick Questions

So I have a couple questions regarding an implementation of a physical joystick within a project of mine. However, let me clarify what I mean by ‘physical joystick’:

This IS NOT about

  • Physical joysticks on an external controller the player would use to play a game

  • Onscreen/GUI/HUD joysticks for controlling the game

This IS about a literal joystick WITHIN the game itself, a physical object, that the player (in this case, a vr project) would physically grab and control. I’m sorry if that explanation is redundant- a lot of google results led me to believe this wasn’t a usually discussed topic.

So the few questions I have regarding this are as follows:

  • How would one lock one end of the joystick to a surface, so that when the object is grabbed only one end is essentially pivoting around that axis?
  • How could I retrieve values of the joystick’s current axis or pivot value, so it could be translated into movement for another object (specifically, another object that would be controlled by the joystick)

Well controlling a virtual VR joystick is generally quite difficult since the user doesn’t get any physical feedback. So there’s nothing that stops the user to move his virtual hand way outside the operational range of the joystick. This makes controlling such a joystick quite difficult. There are generally two different aspects to this sort of thing:

  • First you have the actual operational movements the user can perform. You usually would save the initial position of the hand / input device when you latch onto the virtual joystick. So any delta from this resting position could be interpreted as input depending on how far you moved away from the initial position.
  • The second thing is how you visually represent this. The visually most pleasing feedback is probably if you just attach your “hand” directly to the joystick as long as it’s “attached” and just tilt the joystick according to the axis position from the first point I made.

Now there are essentially two ways to “detach” the hand. Either again by some kind of keypress / input from the user or when you move the hand outside of a certain range. All this highly depends on your exact project setup and requirements.