Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isInSpotLight(spotLight,position)
- local cone = math.rad(spotLight.Angle)
- local part = spotLight.Parent
- local direction = CFrame.new(part.Position, (part.CFrame * CFrame.new(Vector3.FromNormalId(spotLight.Face))).p)
- local space = direction:pointToObjectSpace(position)
- local unit = space.unit
- return (unit.Z < 0) and (unit.X > (cone/-2) and unit.X < (cone/2)) and (space.magnitude <= spotLight.Range)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement