Raycasting from a face?

Hey ,

I wanna know whether we can set the raycast origin as a face .
I had read the docs : Raycaster set docs


.set ( origin : Vector3, direction : Vector3 ) : null

.setFromCamera ( coords : Vector2, camera : Camera ) : null

As it is mentioned it says origin can only be vector3 or camera .
Can a face be set in any means ?

PS : This is a part of my another question : Another Question
where I need to find the distance between 2 meshes at each point .
If someone could help me solve this it would be much appreciated .

Thanks …

No. When the docs mean “camera”, the origin of the ray is actually the position of the camera in world space.

Ray.origin always represents a position in a 3D space. In context of faces, you would have to compute a point that you can use. For example the face’s center point.

2 Likes