Skip to content

Commit 155d4c7

Browse files
committed
Merge pull request mrdoob#7317 from matias-capeletto/dev-raycast-fix
Fix intersection uv for non-indexed BufferGeometry
2 parents 7fbe906 + 6dffe4a commit 155d4c7

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/objects/Mesh.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,22 +218,22 @@ THREE.Mesh.prototype.raycast = ( function () {
218218

219219
if ( distance < raycaster.near || distance > raycaster.far ) continue;
220220

221+
a = i / 3;
222+
b = a + 1;
223+
c = a + 2;
224+
221225
var uv;
222226

223227
if ( attributes.uv !== undefined ) {
224228

225229
var uvs = attributes.uv.array;
226-
uvA.fromArray( uvs, i );
227-
uvB.fromArray( uvs, i + 2 );
228-
uvC.fromArray( uvs, i + 4 );
230+
uvA.fromArray( uvs, a * 2 );
231+
uvB.fromArray( uvs, b * 2 );
232+
uvC.fromArray( uvs, c * 2 );
229233
uv = uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC );
230234

231235
}
232236

233-
a = i / 3;
234-
b = a + 1;
235-
c = a + 2;
236-
237237
intersects.push( {
238238

239239
distance: distance,

0 commit comments

Comments
 (0)