I’m currently making a bow using fastcast, and I’m trying to get the mouseposition. It’s supposed to mostly be used in 3rd person and shift lock. It works whenever I stand still and am walking forward, but whenever I try to walk backwards it returns a position that seems to be excactly where the camera is
Videos of the issue:
“Inside the bow”
Bow video
You can see that the arrows are flying towards the camera whenever I walk backwards
Printing mouse position:
Mouse print video
The X position is the main thing, it says accurately where I am looking normally, but when I begin walking backwards, it returns a position beside the character
I’ve tried making a raycast myself, but that didn’t work.
Another thing I’ve tried is mouse.hit.Lookvector, aswell as mouse.TargetFilter, like in this post: Mouse.Hit behind your character when you walk backwards? ,
but that didn’t work either
I do suspect that mouse.targetfilter or lookvector might be the solution, but I haven’t been able to find anything working.
the different things I’ve tried:
raw mouse.hit:
local function sendEvent()
local mousePos = mouse.Hit.Position
bowFireEvent:FireServer(mousePos)
end
Mouse target filters:
local function sendEvent()
mouse.TargetFilter = player.Character
mouse.TargetFilter = workspace.CurrentCamera
local mousePos = mouse.Hit.Position
bowFireEvent:FireServer(mousePos)
end
Raycast: (I know that this uses the camera lookvector and not the mouse position, but it still doesn’t work for some reason)
local function sendEvent()
local rayOrigin = workspace.CurrentCamera.CFrame.Position
local rayDirection = workspace.CurrentCamera.CFrame.LookVector*1000
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {tool, player.Character}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(rayOrigin,rayDirection,raycastParams)
local mousePos
if raycastResult then
mousePos = raycastResult.Position
else
mousePos = rayOrigin+rayDirection*1000
end
print(mousePos)
bowFireEvent:FireServer(mousePos,power)
end
There’s probably some small thing that I’ve missed this whole time, but I’m really not sure, and I’ve tried fixing this problem for a good amount of time now.
Let me know if I need to provide anything else