Jump to content

Dynamic Asset Loading at Runtime


lateKnight
 Share

Recommended Posts

Hello dear Forum,

i have a Question regarding dynamic Asset Loading in Babylon.js. I was not able to find Information about this topic in the Documentation or the Forum (don´t slay me if I missed something;) ).

So basically what I want to be able to achieve is:

1. User clicks a HTML-Button (for Example "Load Model") // Button should be outside of the Canvas if possible

2. Button calls Function with modelName as Parameter

3. Function checks if Model with modelName exists in some Kind of Library

4. If so, the Model gets Downloaded

5. Model gets rendered

So, as far as i was able to find out, it is totally possible to pass Information from a HTML-Element to the Babylon Engine. But is it possible to download something at runtime (CORS is considered) that has never before been used inside the Project. The reason for this is that I want the Game to handle almost the whole "What shall i display?, Where shall i display it?, Which Components does the Object have" - Functionality dynamically without defining too much of it inside the Project.

I hope I was able to give you an insight into what I want to achieve.

Regards,

Markus

 

Link to comment
Share on other sites

Hi lateKnight. Welcome to the forum :).

I'm not the best coder on this forum by any stretch of the imagination - but I will make a suggestion.

BABYLON.SceneLoader.Append(....)

Create a basic empty/basic BJS scene then have your HTML buttons call a function that uses the above type of code to append your new model to that scene

See here for an example of using that type of function by @JCPalmer

cheers, gryff :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...