checkGeometryIntersection method
Intersection?
checkGeometryIntersection(
- Mesh object,
- Material? material,
- Raycaster raycaster,
- Ray ray,
- BufferAttribute<
NativeArray< ? uv,num> > - BufferAttribute<
NativeArray< ? uv1,num> > - BufferAttribute<
NativeArray< ? normal,num> > - int a,
- int b,
- int c,
inherited
Implementation
Intersection? checkGeometryIntersection(Mesh object, Material? material, Raycaster raycaster, Ray ray, BufferAttribute? uv, BufferAttribute? uv1, BufferAttribute? normal, int a, int b, int c ) {
object.getVertexPosition( a, _vA );
object.getVertexPosition( b, _vB );
object.getVertexPosition( c, _vC );
final intersection = checkIntersection( object, material, raycaster, ray, _vA, _vB, _vC, _intersectionPoint );
if ( intersection != null) {
final barycoord = new Vector3();
TriangleUtil.getBarycoord( _intersectionPoint, _vA, _vB, _vC, barycoord );
if ( uv != null) {
intersection.uv = TriangleUtil.getInterpolatedAttribute( uv, a, b, c, barycoord, Vector2() ) as Vector2;
}
if ( uv1 != null) {
intersection.uv1 = TriangleUtil.getInterpolatedAttribute( uv1, a, b, c, barycoord, Vector2() )as Vector2;
}
if ( normal != null) {
intersection.normal = TriangleUtil.getInterpolatedAttribute( normal, a, b, c, barycoord, Vector3() ) as Vector3;
if ( (intersection.normal?.dot( ray.direction ) ?? 0) > 0 ) {
intersection.normal?.scale( - 1 );
}
}
final face = Face(
a,
b,
c,
Vector3(),
0
);
TriangleUtil.getNormal( _vA, _vB, _vC, face.normal );
intersection.face = face;
intersection.barycoord = barycoord;
}
return intersection;
}