I’m making a game (VR Concerts!) and I want to add a music search, because only having 3 songs available to you is horrible. Obviously this’d be filtered, but I still wonder.
I refuse to use the default roblox ui because it never seems to be in a nice place; I want it to be in front of the players head. This is possible because lots of other VR games that have chat have done it.
I currently do not have a base script, but I can program off of it when I get some ideas of how I’d go about doing this.
Try creating a GUI keyboard that people can “toggle” with either pointing at in in VR, or a key on their VR sticks.
Once the keyboard is up, allow them to use it like a GUI would be on their screen, so they can tap the letters or numbers on their screen, and have the script translate the key pressed on the GUI to an enum.KeyCode, allowing for special characters if needed.
Floating keyboard and some ray casting, you add floating buttons and launch rays from the player’s hand, see which key it points at and once the player presses, they key is written, for text boxes just do TextBox.Text = TextBox.Text + Key_Symbol -- // Set Key_Symbol to the key the player pressed and for backspace TextBox.Text = TextBox.Text:sub(math.min(1, #TextBox.Text), math.max(0, #TextBox.Text - 1)
For rays you could use workspace:FindPartOnRayWithWhiteList(Ray, {Keyboard}) -- // Set Ray to a ray starting from player's hand to player's hand look direction using Ray.new(), Keyboard is the model the keyboard buttons are put
Unfortunately, without using UI it’s near-impossible to do it. Because they have limited keys, and no keyboard. The alternate way would literally be using bricks to control it, so they press bricks on the ground or something.
If you’re using brick hands (like in Vivecraft), I find myself correlating the blocky shape to my actual hand’s hitbox. Using a touch event is probably the most physically-correct way, but touch events are notoriously unreliable. However, there’s plenty of ways to find the intersection of two rectangles, but I’m not smart enough to list them off (Google is your friend)
The only issue is it wouldn’t correlate to the system keyboard, so native TextBoxes wouldn’t actually work without wrapping everything.
I don’t need it for a textbox, luckily, but thank you!
I’m probably going to use rays as they seem the most reliable.
Besides, I have a script, I just need to figure out how I can make it work with my VR hands.