Seems the most crucial thing you’re missing is controller inputs.
The controller inputs can be git gotted with UserInputService and ContextActionService.
The VR control layout is about the same as an XBox controller with slight variations depending on said controller.
Enum.KeyCode.ThumbStick1 for left and ThumbStick2 for right
The R(x) buttons are in order of:
Enum.KeyCode.ButtonR1 - Trigger
Enum.KeyCode.ButtonR2 - Grip
Enum.KeyCode.ButtonR3 - Thumbstick press
Replace the R for an L to use the left controller’s equivalent.
And now movement.
There are a few ways to go about and I will cover the three main ways:
First up is head/hand directed movement (Like Skeds VR Playground), when a button is pressed it will move the camera in the direction that the camera/hand is facing.
Head/Hand directed movement
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera
local ShouldMove = false
RunService.RenderStepped:Connect(function()
if ShouldMove then
local MoveDirection = Camera:GetRenderCFrame().LookVector -- // I use RenderCFrame because it includes the hmd offset
Camera.CFrame = Camera.CFrame + MoveDirection
end
end)
UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.ButtonR2 then
ShouldMove = true
end
end)
UserInputService.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.ButtonR2 then
ShouldMove = false
end
end)
Method number dos is VR Hands styled movement
Left thumbstick controls flat forward and side to side relative movement, and the right thumbstick controls up and down.
I won’t include code but instead a link to another post that includes this in an place file. VR Sandbox
And the last method of movement I will be talking about is the Nexus VR cool kids version. this starts off by disabling the standard movement system, and then calling LocalPlayer:Move or Humanoid:Move.
(I was going to talk about using a rolling ball to move the character but that requires me to go more in depth and I am tired, go study boneworks or clashers vr to figure that one out.)
Humanoid movement
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local Camera = workspace.CurrentCamera
local MoveVector = Vector3.new()
RunService.RenderStepped:Connect(function()
Players.LocalPlayer:Move(MoveVector)
end)
UserInputService.InputChanged:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Thumbstick1 then
if Input.Position.Magnitude > 0.15 then
MoveVector = Vector3.new(Input.Position.X, 0, -Input.Position.Y)
else
MoveVector = Vector3.new()
end
end
end)
You also asked about better hand movements, you will figure that out on your own… eventually.