# Which side of triangle intersection occurs

I’m trying to determine which side of a triangle has been intersected (or clicked)with the goal of understanding the direction of the ray going from camera to point of intersection. I use the following code but it doesn’t work.

`````` eintersects = raycaster.intersectObjects(scene.children)
if (eintersects.length != 0) {
directionVector = new THREE.Vector3(eintersects[0].point.x - camera.position.x,
eintersects[0].point.y - camera.position.y,
eintersects[0].point.z - camera.position.z);
direction = directionVector.dot(eintersects[0].face.normal);
}
.................
if (direction < 0) {
}
``````

Um, not sure I understand this sentence. You already know the direction of the ray by doing this:

``````console.log( raycaster.ray.direction );
``````

@3DGraphics
Hi!
Did I get you correctly, that you want to know if you hit front or back side of a face/triangle?

yes,that is correct

Maybe something like that (haven’t tested, just from the scratch):

``````var localDir = new THREE.Vector3().copy(raycaster.ray.direction).negate();
intersections[0].object.worldToLocal(localDir);
var result = intersections[0].face.normal.dot(localDir) > 0 ? "front" : "back";

``````

Are you saying direction ( the angle the line forms with the positive x axis). if the angle is positive or negative tells me which side of the triangle is hit?

Ok. Thanks, I will give this a try.