Skip to content

Commit

Permalink
fix(troika-3d-text): set correct object in TextMesh raycast interse…
Browse files Browse the repository at this point in the history
…ctions

Issue #62
  • Loading branch information
lojjic committed Jun 17, 2020
1 parent 56daf65 commit 9f3eaa7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/troika-3d-text/src/three/TextMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const defaultMaterial = new MeshBasicMaterial({
const tempMat4 = new Matrix4()
const tempVec3a = new Vector3()
const tempVec3b = new Vector3()
const tempArray = []
const origin = new Vector3()
const defaultOrient = '+x+y'

Expand Down Expand Up @@ -444,7 +445,12 @@ class TextMesh extends Mesh {
0, 0, 0, 1
)
)
raycastMesh.raycast(raycaster, intersects)
tempArray.length = 0
raycastMesh.raycast(raycaster, tempArray)
for (let i = 0; i < tempArray.length; i++) {
tempArray[i].object = this
intersects.push(tempArray[i])
}
}
}

Expand Down

0 comments on commit 9f3eaa7

Please sign in to comment.