File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -125,10 +125,7 @@ export class UX {
125125 const id = controller . userData . id ;
126126 this . initializeVariablesForId ( id ) ;
127127
128- if (
129- intersection . object === this . parent ||
130- intersection . object === ( this . parent as Partial < View > ) . mesh
131- ) {
128+ if ( this . isRelevantIntersection ( intersection ) ) {
132129 this . hovered [ id ] = true ;
133130 this . selected [ id ] = controller . userData . selected ;
134131 if ( intersection . uv ) {
@@ -159,6 +156,20 @@ export class UX {
159156 }
160157 }
161158
159+ /**
160+ * Checks if the intersection object belongs to this UX's attached Script.
161+ * Allow overriding this function for more complex objects with multiple
162+ * meshes.
163+ * @param intersection - The raycast intersection to check.
164+ * @returns True if the intersection is relevant to this UX's parent object.
165+ */
166+ isRelevantIntersection ( intersection : THREE . Intersection ) : boolean {
167+ return (
168+ intersection . object === this . parent ||
169+ intersection . object === ( this . parent as Partial < View > ) . mesh
170+ ) ;
171+ }
172+
162173 /**
163174 * Resets the hover and selection states for all controllers. This is
164175 * typically called at the beginning of each frame.
You can’t perform that action at this time.
0 commit comments