I was trying to code shadows from workspace:Raycast to :Dot()
So, it make shadow to everything, when it shouldn’t.
How i understand, if two vector direction same we got 0 from :Dot()
And i tried to write this code:
function pointLight:CastShadows(color, normal, hit)
if hit:Dot((self.position - normal).Unit) > 0 then
--local shadowRay = workspace:Raycast(hit, (self.position - hit).Unit * 1000)
--if shadowRay then
return color:Lerp(Color3.new(0, 0, 0), 0.55)
--end
end
return color
end
Normal is raycastResult.Normal
Hit is raycastResult.Position
self.position is light position
But this code didn’t work at all, this code just makes a half of world in shadow