Adding geo at runtime

Folks,

Was looking at the Asset Registry api docs and had a question.

It looks like you can load any kind of asset at runtime…texture, animation, audio, model…

For model, can we load a .fbx or would the file loaded have to be a .JSON file previously created in PlayCanvas?

Your model will need to be a .JSON in the format created by playcanvas. So the easiest way is to do exactly what you said --> have a .json version of the model that’s created by playcanvas

To load a FBX file directly at runtime is not possible by the engine. You would need to write your own custom FBX loader. However, you can use the PlayCanvas editor to do the conversion and download the JSON file to host somewhere else.

Example here: Load 3D models at run time from a PlayCanvas application

Thanks guys, that’s what I figured.

I’m starting to spitball how we can put assets into a database or CMS, sounds like during the asset development phase we’ll have to add one more step where we import the asset into Playcanvas and then export the .Json from playcanvas.

You may want to consider writing your own FBX->JSON converter so you can do this as a batch job offline. I think the JSON file format that PlayCanvas is available somewhere on GitHub in their repo.