Astro
Astro

Reputation: 614

RayCast intersect on multimaterial

Is there any particular reason why raycast intersection fails when applying multimaterial (in my case LambertMaterial with wireframe:true + LambertMaterial with just color) on mesh?

If I apply "solid" material (means any material without wireframe:true) intersection works, if I apply multimaterial (solid+wire, or solid+solid), no intersection occurs.

Bug?

Upvotes: 1

Views: 311

Answers (1)

WestLangley
WestLangley

Reputation: 104843

If you look at the source for THREE.SceneUtils.createMultiMaterialObject you will see that it creates the multi-material effect by creating child meshes of a parent object.

You need to pass the recursive flag into intersectObjects() like so:

raycaster.intersectObjects( objects, true );

three.js r.63

Upvotes: 2

Related Questions