I have laptop model and i try to apply iframe into the screen, how do i do it?
I found a tutorial but it’s only apply with react fiber and my whole project is base on JS and I cant transfer it now to fiber react, I tried but its too much of a mess.
Do you allow the users rotate around the laptop in a way that the screen at any given point would be obstructed by anything or facing back to the camera?
If no - you can use CSS3DRenderer (code in the bottom-right. Keep in mind - iframe contents like that YT video can overlap one another, but they will not interact with any 3D models or parts of the 3D world in three.js. It’s a separate DOM layer rendered above the 3D, iframe HTML will always render above 3D, hence the question at the top.)
If yes - start over, with react-three-fiber. Writing that CSS-occlusion will likely take you more time than doing the project from scratch in r3f. Don’t port - just start over, it’s always a bit annoying, but usually way quicker and cleaner than porting.
the problem you will face pretty much all the time in vanilla
there is little to no re-usable code anywhere due to limitations with OOP
doing things yourself is very, very complex, you need to be well versed in math
you will need a lot of code
the code will be unprincipled (mutation, traversal, race conditions are common)
in this case for instance there’s css3drenderer, but it can’t hide behind geometry. if you turn the laptop it will be visible on the back. to fix this will cost you an arm and a leg — i’ve seen tutorials adding raycast towards the camera to it, making it invisible if anything in between hits the view. but that would be expensive, and hard to implement.
learn react, pair it to threejs. your threejs experience will be better. this is the only eco system you have in this space, people can share their solutions as re-usables.
Not sure how the answer above serves your question, probably quite frustrating trying to get answers at the end of a project and being told “forget learning and throw your hard work in the bin” basically, anyway here’s a great thread and resolve from @trusktr on how to achieve exactly what you require in plain three.js.