Hello! I am attempting to create a reflection script that causes a GUI(textlabel) to bounce off the edges of walls using math.clamp
.
The gui glides perfectly when i set the direction, but problems occur when I want it to bounce. Sometimes it bounces in the direction expected, but sometimes it doesn’t at all, even gets stuck in corners at times because of this.
Code:
function CalculateBounce(currentNormal, normal)
local reflect = currentNormal - 2*(currentNormal*normal) * normal
return reflect
end
I have the equation for this but I may have done something wrong. This is the video of it:
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.