What are useful links to learning VR Scripting in roblox?

Hello everybody! I recently wanted to try to make a VR experience. I’ve currently managed to make sort of an R6 hand movement, but I’m still trying to learn

What are some good examples and tutorials I can learn for VR roblox?
If you don’t mind, where can I learn the following?

  • Making Better Hand Movement (example: VR Hands; for example I don’t know how to get a VR controller’s inputs.)
  • Motion moving (Using Left Thumbstick; again, don’t know how to get a VR controller input; also don’t know how to move the player. Should I use CFrame?)
  • Grabbing stuff (I’ll learn this easily myself if I get how to see a player’s VR controller input; in short if something’s unanchored I can make it attach it to my hand)
  • Opening doors [Really crucial, the hardest one I got blocked on. How can I make a door swing (I know it’s using hinges) when grabbing a Trigger?]

TL;DR: What links and sources can I use to get better at VR scripting? because I can’t seem to find proper documentation on the Roblox DevForums)

Links I’ve found useful so far:

2 Likes

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.

1 Like

Thanks! Will look into this. (30)

Hey, ik I should make my own post & that this is from 2yrs ago but I need to ask you directly, bc I cannot find anything (your the only “lead” I have). I’ve got ball locomotion working, but I cant for the life of me figure out how to make it move with you in real life aswell. I’ve been searching for the hole day.