local W=game:GetService("\087\111\114\107\115\112\097\099\101")local z=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local g=game:GetService("\071\117\105\083\101\114\118\105\099\101")local Q=game:GetService("\082\117\110\083\101\114\118\105\099\101")local s=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local t=require(z:WaitForChild("\078\101\120\117\115\086\082\066\097\099\107\112\097\099\107"))if not s.VREnabled then local Q=require((z:WaitForChild("\078\101\120\117\115\086\082\066\097\099\107\112\097\099\107")):WaitForChild("\067\104\097\114\097\099\116\101\114\066\097\099\107\112\097\099\107"))Q.GetBackpackCFrame=function(z)return W.CurrentCamera.CFrame*CFrame.new(0,0,-2)end Q.GetHandPosition=function(z)local Q=z.Backpack.Part.Size local t=W.CurrentCamera.CFrame*CFrame.new(0,0,-2)local f=s:GetMouseLocation()-g:GetGuiInset()local k=W.CurrentCamera:WorldToScreenPoint((t*CFrame.new(-Q.X/2,Q.Y/2,0)).Position)local I=W.CurrentCamera:WorldToScreenPoint((t*CFrame.new(Q.X/2,-Q.Y/2,0)).Position)local Z=(f.X-k.X)/(I.X-k.X)local R=(f.Y-k.Y)/(I.Y-k.Y)return(t*CFrame.new(Q.X*(Z-.5),Q.Y*(.5-R),0)).Position end t:SetKeyCode(Enum.KeyCode.Q)end t:Load()
--[[
TheNexusAvenger

Loads Nexus VR Backpack on the client for testing.
--]]

local Workspace = game:GetService("Workspace")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GuiService = game:GetService("GuiService")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local NexusVRBackpack = require(ReplicatedStorage:WaitForChild("NexusVRBackpack"))



--Prepare Nexus VR Backpack for non-VR testing.
if not UserInputService.VREnabled then
    --Modify the CharacterBackpack for non-VR testing.
    local CharacterBackpack = require(ReplicatedStorage:WaitForChild("NexusVRBackpack"):WaitForChild("CharacterBackpack"))
    CharacterBackpack.GetBackpackCFrame = function(self)
        return Workspace.CurrentCamera.CFrame * CFrame.new(0, 0, -2)
    end

    CharacterBackpack.GetHandPosition = function(self)
        --The following is long because the API to test with is in world space.
        --Since the backpack is a SurfaceGui in 3D space, this is required to translate the mouse into 3D space relative to the backpack.
        local BackpackSize = self.Backpack.Part.Size
        local BackpackCFrame = Workspace.CurrentCamera.CFrame * CFrame.new(0, 0, -2)
        local MouseLocation = UserInputService:GetMouseLocation() - GuiService:GetGuiInset()
        local UpperLeftCorner = Workspace.CurrentCamera:WorldToScreenPoint((BackpackCFrame * CFrame.new(-BackpackSize.X / 2, BackpackSize.Y / 2, 0)).Position)
        local BottomRightCorner = Workspace.CurrentCamera:WorldToScreenPoint((BackpackCFrame * CFrame.new(BackpackSize.X / 2, -BackpackSize.Y / 2, 0)).Position)
        local RelativeX = (MouseLocation.X - UpperLeftCorner.X) / (BottomRightCorner.X - UpperLeftCorner.X)
        local RelativeY = (MouseLocation.Y - UpperLeftCorner.Y) / (BottomRightCorner.Y - UpperLeftCorner.Y)
        return (BackpackCFrame * CFrame.new(BackpackSize.X * (RelativeX - 0.5), BackpackSize.Y * (0.5 - RelativeY), 0)).Position
    end

    --Set the non-VR keybind.
    NexusVRBackpack:SetKeyCode(Enum.KeyCode.Q)
end

--Load Nexus VR Backpack.
NexusVRBackpack:Load()