I have tried the alignposition and orientation but its not working any help will be appreciated
1 Like
Not sure if this code will work but you can try it.
Local script
local VRService = game:GetService("VRService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local VRInputEvent = ReplicatedStorage:WaitForChild("VRInputEvent")
local function onRenderStep()
local leftHandCFrame = VRService:GetUserCFrame(Enum.UserCFrame.LeftHand)
local rightHandCFrame = VRService:GetUserCFrame(Enum.UserCFrame.RightHand)
-- Fire the remote event with the VR input data
VRInputEvent:FireServer(leftHandCFrame, rightHandCFrame)
end
-- Connect the function to the RenderStepped event
game:GetService("RunService").RenderStepped:Connect(onRenderStep)
Server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local VRInputEvent = ReplicatedStorage:WaitForChild("VRInputEvent")
local function onVRInputReceived(player, leftHandCFrame, rightHandCFrame)
local character = player.Character
if character then
local leftHand = character:FindFirstChild("LeftHand")
local rightHand = character:FindFirstChild("RightHand")
if leftHand and rightHand then
-- Set the CFrame of the left and right hand parts to match the VR input
leftHand.CFrame = leftHandCFrame
rightHand.CFrame = rightHandCFrame
end
end
end
-- Connect the function to the OnServerEvent event of the remote event
VRInputEvent.OnServerEvent:Connect(onVRInputReceived)
You must also create an remote event called VRInputEvent in the ReplicatedStorage
This will 100% not work. You cannot just change the CFrame of random parts of your character. You need some advanced Trigonometry reverse IK stuff for it to work.
For OP, You should use Nexus VR if you don’t want to work for VR support.
i am trying to make my own system so i make my game. but i appreciate it
Ah alright, thank you for telling me
That wouldn’t really require trigonometry at all. It would have to be a different branch of math but not trigonometry but you could use it.