Help getting the perpendicular to a 2D Object

Hello everyone.
This problem has be for a few days.
I’ll go ahead and explain.

Basically i want to a force to the red ball. The force I want to add is the green arrow.
The Green arrow is perpendicular to the blue arrow.

The platform has always a BoxCollider2D. So I have tried different methods but i don’t know how to calculate the blue arrow.
Has anyone have any idea how to do it? It seems such an easy problem but I can’t figure it out.

Raycasting against any collider (2D or 3D) will get you information about where you hit it.

That information contains things such as where in space (point or position), and orientation of the surface (also known as normal).

Here is the Raycast to use for 2D use:

If you are only raycasting at ONE collider (instead of all of them in the scene), you can use this:

… which takes a reference to the collider in question.

Using the normal and the incoming line, you can reflect it with:

Before going too deeply into trying to use it in a realtime rapidly-changing game, try setting up a test scene with some test scripts to understand the process of all the parts. The API docs above have sample code.