#math idiot here

2 messages · Page 1 of 1 (latest)

keen swallow
#
HitP = (Vector3.new(mouse.Hit.X,0,mouse.Hit.Z) + Vector3.new(0,4,0))

local RayCastDistance = 1000

        local RayCastParams = RaycastParams.new()
        RayCastParams.FilterDescendantsInstances = {Variables.Tool:WaitForChild("Handle"),workspace:FindFirstChild("Door"),LocalCharacter,workspace:FindFirstChild("Bullet"),workspace.CameraPart}
        RayCastParams.FilterType = Enum.RaycastFilterType.Exclude

        
        local Direction = (HitP-GunParts.Muzzle.Position).Unit * RayCastDistance

        local RayCastResult = workspace:Raycast(GunParts.Muzzle.Position, Direction, RayCastParams)

        if RayCastResult and RayCastResult ~= nil then -- Confirm if RayCast does exist.
            local position, hit = RayCastResult.Position, RayCastResult.Instance```
#

I wanna change this raycast so it fires where the gun muzzle is facing instead of where the mouse is at