C
C#11mo ago
MRW419

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
cap5lut
cap5lut11mo ago
no matter where on that one side of the block where it hits, the normal is the same
MRW419
MRW419OP11mo ago
So the normal is just the middle of the block?
cap5lut
cap5lut11mo ago
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
MRW419
MRW419OP11mo ago
Could you show a picture. Cause I think I get it but at the same time not
cap5lut
cap5lut11mo ago
lets assume this plane is the side of the box that got hit, and that we hit it in the center.
No description
cap5lut
cap5lut11mo ago
the normal vector is the same for every point on that plane
cap5lut
cap5lut11mo ago
(ignore my lack of editing skills)
No description
cap5lut
cap5lut11mo ago
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.
cap5lut
cap5lut11mo ago
thats because the plane/side of the box/wooden plank is flat. for spheres the normal would be different for each point:
No description
MRW419
MRW419OP11mo ago
So the normal is this invisible line where these lines would face? Sorry if i'm understanding it still
cap5lut
cap5lut11mo ago
yes
cap5lut
cap5lut11mo ago
maybe this graphic illustrates it better:
No description
cap5lut
cap5lut11mo ago
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
MRW419
MRW419OP11mo ago
I see so no matter where you look it will stick in that one place. Basicly grabing that line that saying where it hit?
cap5lut
cap5lut11mo ago
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
No description
MRW419
MRW419OP11mo ago
But that makes me question. When we grab the normal what is the length of that line?
cap5lut
cap5lut11mo ago
normals are "normalized" vectors, they always have a length of one
cap5lut
cap5lut11mo ago
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.
No description
Want results from more Discord servers?
Add your server