So, i'm trying to rotate a fairly basic object to always face the mouse when fired, however nothing i tried seems to work, i would really appreciate some help with this, this is the closest i've been able to get to what i need. Here's the code involved:
local function getPitch(vec)
return math.asin(vec.y) - math.pi/2
end
local function getYaw(vec)
return math.asin(vec.x) + math.pi/2
end
local pitch = getPitch(hit.LookVector)
local yaw = getYaw(hit.LookVector)
trident.CFrame = hrp.CFrame * CFrame.new(0,5,0) * CFrame.Angles(pitch,yaw,math.rad(90))
