Detection using default intersectObjects #59
Unanswered
antonyadhiban
asked this question in
Q&A
Replies: 1 comment
-
Hi ! Yes you can, although I will concede this is not very intuitive. All three-mesh-ui components extend Here is a fiddle to help you out : https://jsfiddle.net/felixmariotto/fpwnLmv0/1/ This is the relevant part : const intersects = raycaster.intersectObjects( objectsToTest, true );
intersects.forEach( (intersection) => {
intersection.object.traverseAncestors( (ancestor) => {
if ( ancestor.isUI ) {
ancestor.set({
fontColor: new THREE.Color( 0xffffff * Math.random() ),
backgroundColor: new THREE.Color( 0xffffff * Math.random() )
});
}
});
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to detect UI using the default intersectObjects function in three.js instead of using custom raycast() function from interactive.js example ?
I tried detecting the UI using intersectObjects and got back a MeshUI-Frame block which does not contain properties like isUI, states, currentState etc.
Please let me know if I am missing something or it is intended this way.
Greatly appreciate the effort to create such a great library.
Beta Was this translation helpful? Give feedback.
All reactions