Calculating bounce LookVector from 2 LookVectors

I want to calculate a LookVector when a ball would bounce on the wall. The first LookVector is the direction of the balls movement, the other LookVector is the walls normal.

I am, in fact, trying to sort of mirror the vector.

I have tried multiple things that work in one dimension, but it is hard to think in three dimensions.

What math is needed to to this?

The ball, wall, and LookVectors:

The expected outcome:

1 Like
local function reflect(vector, normal)
	return -2 * vector:Dot(normal) * normal + vector;
end

This is the function you’re looking for.

That is exactly what I was looking for. Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.