Help me understand
So lastRaycastHit.normal is the surface of what the raycast hit? So if I look at a block it would take the surface of that block and where it's located in a Vector 3?
18 Replies
no matter where on that one side of the block where it hits, the normal is the same
So the normal is just the middle of the block?
the normal is perpendicular to the surface it hit
its the up vector of that surface
because the surface of each side of the box is flat, the normal of that side stays the same for every position on that side
Could you show a picture. Cause I think I get it but at the same time not
lets assume this plane is the side of the box that got hit, and that we hit it in the center.
the normal vector is the same for every point on that plane
(ignore my lack of editing skills)
imagine u would have a wooden plank, and hammer in nails completely perpendicular, so they stick out on the other side
the other side would be the front, and no matter how u rotate the plank, all nails would have the same orientation.
thats because the plane/side of the box/wooden plank is flat.
for spheres the normal would be different for each point:
So the normal is this invisible line where these lines would face? Sorry if i'm understanding it still
yes
maybe this graphic illustrates it better:
the incident ray, is basically the ray which u used for the ray cast.
now think about what happens if u move the origin of the ray, but the direction stays the same.
u would hit the mirror at another point, but because the direction of the ray is the same, the angles are also the same, and thus is the normal, because the mirror is flat
I see so no matter where you look it will stick in that one place. Basicly grabing that line that saying where it hit?
i have drawn in a bunch of normals for the box. each normal has exactly 90° to the surface
because the surface for each side is flat, at every point of the side the same normal can be calculated
But that makes me question. When we grab the normal what is the length of that line?
normals are "normalized" vectors, they always have a length of one
i have drawn in some ray casts (red and green arrows):
they have completely different angles and distance, they only have in common that they hit the same side of the box.
so their hitpoints have are different points on the side, but because its the same side, they have the same normals.