so i am trying to make a vr game and i need position of input to move a finger of the player, but when im trying to do it it just prints nothing, heres the code:
local UserInputService = game:GetService("UserInputService")
UserInputService.InputChanged:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.ButtonR2 then
print(input.Position.Z)
end
end)
tried everything, printing the keycode of the input, parenting the script to starterplayercharacter, starterplayerscripts, startergui, everything(this is a local script)
ive seen many vr games do it, like when i try to hold R1 but not fully in some vr games its going to be in the middle, and i think they used InputChanged
no worries for late response, i have strange timezone
If by “other VR games” you mean games like Bonelab, Boneworks, VRChat etc, the reason they can do it is because they aren’t on roblox. Usually, the inputs would be passed through, this is just a stupid limitation roblox has, and has had forever.
Every roblox game I’ve played in VR has had these same limitations, and playing on controller has the same limitations. There is no way (at least from my testing a few years back) to get how pressed down a trigger is.
My bad, I was actually wrong here. Somethings changes since I last tested or I did barely any research. Last time I saw anyone ask about this was on the VR Hands server, where someone said it wasn’t possible. With how stupid the roblox engine is at times, I assumed it was true for all this time.
Here’s code that worked for me:
game:GetService("UserInputService").InputChanged:Connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.ButtonR2 then
print(inputObject.Position.Z)
end
end)
I did test this with an XBOX controller (since with me using a Vive, the openXR settings for roblox are broken), so I’m not sure how it’ll work in VR.
I do have a theory that you having gameProcessedEvent returning is what cancelled it from printing, as all results I found from a quick search don’t have it.