How to assure player floating and having movement in VR?

I’ve took @infiniteRaymond 's advice and gone trough making the base properties for the hands and hand. I just need to know how to make them float and not fall down and having actual movement aswell with joystick.

Since I’m already here, I might as well give a bit of the code you can use, and a bit of advice.

For the movement, this should work. Unfortunately it still only moves forward and backwards, but I haven’t bothered to fix that as it hasn’t really made the experience worse in my opinion, but you can change it if you’d like.

local VRService = game:GetService('VRService')
local UserInputService = game:GetService('UserInputService')

local function gprtc(cf)return Camera.CFrame*CFrame.new(cf.p*Camera.HeadScale) * (cf - cf.p)end
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CFrame.new(0,0,0)

local MoveY = 0

game:GetService("RunService").Stepped:Connect(function()
	-- Move the player, this should be done first so there isn't a delay when moving
	local MoveSpeed
	if UserInputService:IsGamepadButtonDown(Enum.UserInputService.Gamepad1, Enum.KeyCode.ButtonL3) then
		MoveSpeed = 1.5
	else
		MoveSpeed = 1
	end
	local offsetCFrame = CFrame.new(gprtc(VRService:GetUserCFrame(Enum.UserCFrame.Head)).LookVector)
	Camera.CFrame = (Camera.CFrame:ToWorldSpace(CFrame.new(offsetCFrame.X/3*MoveY*MoveSpeed, 0, offsetCFrame.Z/1.5*MoveY*MoveSpeed)))
end)

UserInputService.InputChanged:Connect(function(input, processed)
	if input.UserInputType == Enum.UserInputType.Gamepad1 then
		if input.KeyCode == Enum.KeyCode.Thumbstick1 then
			MoveY = input.Position.Y
		end
	end
end)

This should be placed in a localscript, many adjustments should be made to fit, especially the speed.

If you’re looking to make players throwable, or just objects, you should use BodyPosition and BodyGyros with Network Ownership.

2 Likes