-
Notifications
You must be signed in to change notification settings - Fork 32
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
Question: Swapping multiple scenes #53
Comments
Hi
But I have to notice. At this moment Blazor 3D is in the early development stage, so it cannot support all the features of the THREE.js. There is no full synchronization between scene objects on JS side and .NET side. For more info see HomagGroup/Blazor3D#31 |
Thanks for the quick response! Now that I've had the chance to finally sit down and try to play around with this, I'm realizing that I both over-complicated and oversimplified what I need to do. In my situation I need to be able to not "just" swap what scene is visible in the viewer at any given point in time, but rather be able to hide the 3D scene when I don't want/need it. Basically have it appear and disappear at the click of a button. In principle this is something that should be fairly easy to do, as shown in the following
And while this works in theory, in practice it only does half of the job. When I click to hide, then the Getting to your comment about Blazor 3D being in early development, maybe you can help me understand to what extent it's current state would cover my needs. Ultimately what I'm looking for can be best described as a glorified model viewer:
Would these kinds of capabilities be available, even if I need to turn to JavaScript to achieve them? So far I've only gotten as far as Example 2 to get my model to successfully appear in the scene (and the viewer in its default state already seems to accomplish most of 2. above). Thanks again for your quick response, it's much appreciated! |
I've been trying to look into 3. above (detect click on individual meshes within the model), and the closest I've been able to figure out would be to use I'm loading a Collada model which contains a group with a series of child meshes. The Group and all child meshes have a name, id, and sid. On import I can see everything (group with all child meshes), though Thanks again! |
Hi.
probably you have to call StateHasChanged when state isHidden == false in your OnClickHide method |
The problem is .NET part knows only about root node of imported object. You can find more information here HomagGroup/Blazor3D#31 (in the Examples repository) |
Unfortunately no errors are raised, and calling StateHasChanged doesn't change anything. I tried what you provided, and while that does work, it triggers the destruction/recreation of the scene when hidden/shown, something that I was hoping to avoid. I have the suspicion/fear that what I'm trying to do is not possible with Three.js (and by extension Blazor 3D).
Ok, thanks for the information! I had a hunch that that topic referenced the same issue (or at least was related), I'll look forward to whatever seratechnl comes up with. |
Having some more time to come back and take a look at this, I've found out what the problem is. Everything is "working" in the important sense, however the canvas has a height of 0. When viewed through the Firefox Web Developer Tools Inspector, on initial load (when it can be seen properly) the relevant HTML section is
after hiding and showing it the height is now 0
If I change the height in the Inspector back to 635 is appears as expected. |
Greetings,
I am curious to know if it possible to swap between two (or more) 3D scenes, without needing to rebuild/recreate them on access? What I'm imagining is two different scenes, where each scene contains an interactive model. You can click things on the model, and the scene then updates in response (i.e.: click a door and the door opens). What I would like to be able to do,as an end user, is easily/quickly swap between these two scenes without needing to recreate them. For example:
Could something of this sort be done? Given how the Viewer and Scene is separated in the example code I can see, I could foresee being doable (viewer.setScene(...)), or perhaps creating two Viewers (one for each scene) and then alternating which one is embedded into the page?
Thanks!
The text was updated successfully, but these errors were encountered: