Hi! i’m trying to make an arrow point to the direction the player’s mouse is but the thing is Mouse.UnitRay.Direction doesn’t work too well, if i use the Mouse.Hit it gives me the position the mouse is pointing at but i want the direction not position and if i use the Mouse.Hit as LookAt in CFrame it doesn’t look as wanted.
This is what i use rn and i ain’t really satisfied with the result.
mouse.Move:Connect(function()
if not spectateMode2 and play and not pause then
if not stopArrowMove then
local newPos = Vector3.new(mouse.Hit.X, newBall.Position.Y, mouse.Hit.Z)
arrow.CFrame = CFrame.new(newBall.Position, newPos)*CFrame.new(0, 0, -7)
end
else
arrow.Decal.Transparency = 1
end
end)
Well, i think it works as intended but if i put my mouse on one of the props the direction ain’t really good, let’s say i have a decoration on the map that is with CanCollide off and the player’s ball (since golf game) got shot and ended up inside it, you can’t shoot anymore because the direction gets messed up because your mouse points into the object.
I’d be more interested on maybe just being able to make a ray myself in the same direction and avoid some elements of the map. I tried directly using Mouse.UnitRay.Direction but i doesn’t move like at all and i don’t think it would make any difference if i make a ray using that direction.