Make arrow fly to mouse cursor position

I understand, thank you for the detailed response. I actually tried offseting mousehitposition but to no avail, didnt try it the way you just showed, let me try and come back

The issue in the video disappeared, but arrow once again flies lower than the mouse cursor is. Perhaps we could change just the Z offset of mouse hit position? Or maybe make it fly to currentCameralookVector, but again with a given offset. It is just unclear to me how to apply offset to a lookvector, since it is not a normal vector3, but rather weird decimals that i have no clue how are calculated

this should be a mix of the cameras look vector and the direction to the mouse hit

local speed = 4
flyEvent.OnClientEvent:Connect(function(arrow)
	-- get the cameraUpVector
	local cameraUpVector = workspace.CurrentCamera.CFrame.UpVector

	-- get the cameraRightVector
	local cameraRightVector = workspace.CurrentCamera.CFrame.RightVector

	-- get the directionUpVector
	local directionLookVector = (mouse.Hit.Position - arrow.Position).Unit
	local directionRightVector = cameraUpVector:Cross(directionLookVector)
	local directionUpVector = directionLookVector:Cross(directionRightVector)

	-- use the cameras right vector and the directions up vector to workout a new vector
	local direction = cameraRightVector:Cross(directionUpVector)

	arrow.LinearVelocity.VectorVelocity = direction * speed
	arrow.LinearVelocity.Enabled = true
end)
1 Like

Thank you so much for your consistent effort, I think this will work, unable to try right now since im at another location than the computer. Anyway marking as solution for now. I’ll try tomorrow, and if this doesnt work, ill mark as solution your answer that it is impossible.

Which is the reason for the first variable. It converts the 2D position to a 3D ray.

This gives error at line

local directionLookVector = (mouse.Hit.Position.Y - arrow.Position.Y).Unit

Attempt to index number with unit

Oops forgot to remove the .Y from the positions

I updated the message with the correct code