Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent bounding boxes #70

Closed
Utopiah opened this issue Mar 30, 2023 · 7 comments
Closed

Inconsistent bounding boxes #70

Utopiah opened this issue Mar 30, 2023 · 7 comments

Comments

@Utopiah
Copy link
Contributor

Utopiah commented Mar 30, 2023

Hi,

I tried to repeat AdaRoseCannon/aframe-htmlmesh#4 here but it didn't work. I tried making a bounding box but the geometry was very different from what I expected, namely a square rather than a rectangle.

In the screenshot below I can show one that worked, the lower one, and one that didn't, despite using the same code

el = new THREE.BoxHelper( document.getElementById("locationreload").object3D.children[0], 0x00ff00 ); AFRAME.scenes[0].object3D.add(el)

image

Is somehow forcing a sync() necessary? Did I miss a step? Note that I did that via the console and seconds after the scene was displayed so I'm relatively confident everything was loaded, at least displayed as it should. I also noticed #38 before but again, I'm not doing it right after adding the element so not sure it would relevant here.

Anyway, what is the recommended way to add a background behind an entire element or part of it?

PS: I noticed https://protectwise.github.io/troika/troika-three-text/#carets-and-selection-ranges that could later on be useful to highlight words or lines but didn't dive in there before being able to have the entire element.

@Utopiah
Copy link
Contributor Author

Utopiah commented Mar 30, 2023

The AFrame inspector also makes the square bounding boxes on element selection

image

@Utopiah
Copy link
Contributor Author

Utopiah commented Mar 30, 2023

image

If I change value from 12345 to 1 the bounding box does seems like it is update properly so... maybe unrelated, maybe a threejs/AFrame boxhelper issue. Leaving this open for now as I still investigate.

@Utopiah
Copy link
Contributor Author

Utopiah commented Mar 30, 2023

Seems it's a boxhelper issue as the boundingbox itself seems fine and creating a boxgeometry from it works as expected. Less convenient but sufficient to add a background.

image

@Utopiah Utopiah closed this as completed Mar 30, 2023
@lojjic
Copy link
Owner

lojjic commented Mar 30, 2023

My suspicion is the BoxHelper was reading the geometry.boundingBox before the text sync() callback is complete and not getting updated afterward? 🤷

@lijualivenow
Copy link

I am facing the same issue, the bounding box is not getting properly

@Utopiah
Copy link
Contributor Author

Utopiah commented Sep 13, 2023

@lijualivenow try checking 1000ms after creating the entity and if it does make a difference tried indeed .sync() and check after, iirc worked for me.

@lijualivenow
Copy link

@Utopiah, after 1000ms it's working, thank you.

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

No branches or pull requests

3 participants