for some reason, my raycast is still coming from the origin with ViewportPointToRay with custom shiftlock
ViewportPointToRay code
return function(ignore)
local mouseLocation = input:GetMouseLocation()
ignore = ignore or {}
params.FilterDescendantsInstances = ignore
local pointedRay = camera:ViewportPointToRay(mouseLocation.X, mouseLocation.Y)
local hitRaycast = workspace:Raycast(pointedRay.Origin, pointedRay.Direction * 250, params)
return hitRaycast and hitRaycast.Instance.Parent
end
camera offset/shiftlock code
if self.ShiftlockEnabled and camera.CameraType ~= Enum.CameraType.Scriptable then
local humanoid = player.Character.Humanoid
local humanoidRootPart = player.Character.HumanoidRootPart
if player:DistanceFromCharacter(camera.CFrame.Position) > 1 then
camera.CFrame *= CFrame.new(1.75, 0.2, 0)
input.MouseBehavior = Enum.MouseBehavior.LockCenter
humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.Position, camera.CFrame.LookVector * self.CameraOffset)
humanoid.AutoRotate = false
else
humanoid.AutoRotate = true
end
end
for some reason it seems to only be affected in r6 i believe, which is annoying because my game is designed for r6.