Skip to content

Add support for custom raycaster intersection classes#6

Merged
MakingSpiderSense merged 1 commit into
mainfrom
feature/holdable/90-add-custom-raycaster-classes
Jul 10, 2025
Merged

Add support for custom raycaster intersection classes#6
MakingSpiderSense merged 1 commit into
mainfrom
feature/holdable/90-add-custom-raycaster-classes

Conversation

@MakingSpiderSense
Copy link
Copy Markdown
Owner

Add support for custom raycaster intersection classes, rather than using the “interactable” class. Use data-holdable-intersection-class="your-class" on <a-scene> to set a custom class.

https://trello.com/c/B3O8ZNKt

Copilot AI review requested due to automatic review settings July 10, 2025 00:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for a customizable raycaster intersection class for the holdable component and standardizes the grab-position attribute name.

  • Documentation updated to describe custom intersection class and new scene-level attribute.
  • Logic added to read data-holdable-intersection-class from <a-scene> and apply it to entities.
  • Renamed scene grab-position attribute from data-grab-position to data-holdable-grab-position.
Comments suppressed due to low confidence (4)

src/components/holdable/holdable.js:11

  • [nitpick] The prefix "Rare:" is nonstandard and may confuse readers. Consider replacing it with "Note:" or aligning it with the existing list labels for clarity.
 * - Rare: If you want to use another class for raycaster intersections instead of "interactable", you can add it globally to the scene using `data-holdable-intersection-class="your-class"`. This will be used for all holdable objects unless overridden.

src/components/holdable/holdable.js:11

  • The documentation mentions "unless overridden," but the code only reads the scene-level attribute. Either remove that phrase or implement per-entity override support to match the docs.
 * - Rare: If you want to use another class for raycaster intersections instead of "interactable", you can add it globally to the scene using `data-holdable-intersection-class="your-class"`. This will be used for all holdable objects unless overridden.

src/components/holdable/holdable.js:45

  • Add unit tests to verify that the data-holdable-intersection-class attribute is correctly read from the scene and applied to entities.
        const sceneIntersectionClass = this.el.sceneEl.getAttribute("data-holdable-intersection-class");

src/components/holdable/holdable.js:45

  • [nitpick] Consider also checking for a per-entity data-holdable-intersection-class attribute (e.g., this.el.getAttribute(...)) so users can override the intersection class on individual holdable objects.
        const sceneIntersectionClass = this.el.sceneEl.getAttribute("data-holdable-intersection-class");

@MakingSpiderSense MakingSpiderSense merged commit 935883a into main Jul 10, 2025
@MakingSpiderSense MakingSpiderSense deleted the feature/holdable/90-add-custom-raycaster-classes branch July 10, 2025 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants