THree.js collada loader - three.js

It is interesting that all examples using Collada loader loads have one model. I am having trouble loading multiple. I have tried the following
1) Create one loader and just try to load all models using it without waiting for previous
one to finish. This failed it looked like i got mixture of models in my models
2) Create one loader and wait for each model to load before loading next. This failed
but I am not sure if I am doing something wrong.
3) Create a different Loader for each model. This works but it seems a waster.
My question is how is three.js Collada Loader designed to handle multiple models?

Related

cannon.js basic physics setup as class in three.js

Very new to coding and Im following a course on three.js using cannon-es, I have quickly come to understand the need to keep things organized in classes using constructor, (my project is currently all in one or two files and is getting messy.) But still confused as to how to convert existing code into a class. I would like to see an example of basic cannon physics setup as a class or how I can make one.
I was in the same situation and was able to make parts as classes but seems buggy as when I add new objects to the Cannon world,the objects before disappear,don't know what causes this but I can share my code with you so we can solve this issue if you are willing.

How to use THREE.JSONLoader after R99

Now the JSONLoader had been removed, how could I load the models that loaded by JSONLoader before?
Yes, JSONLoader was removed from three.js with R99. But the loader is still available as LegacyJSONLoader. If you include the file into your project, you can create an instance of LegacyJSONLoader and load your JSON model as before.
Keep in mind that you are using an obsolete JSON format. You might want to consider to export your models to glTF via GLTFExporter in order to use a future-proof 3D format. The following example demonstrates the usage of the mentioned exporter:
https://threejs.org/examples/misc_exporter_gltf.html
ObjectLoader is available and it works as JSONLoader

model view Object to Geometry mapping

We have followed the step-by-step tutorials for the model-derivative apis. I can use the /manifest endpoint to get the object tree. I can also create tasks to get a .obj file with geometries of some objects. There is no way to know which geometry belongs to which object.
I could potentially create a job for each object, but that would require thousands of jobs per model which seems excessively inefficient. Are we missing something? Any pointers on how to get geometry for objects while retaining the mapping between them?
The Viewer will extract the information, but as of today, we don't have a documentation for SVF, so it may get trickier to analyze the geometry from this file. You may use JavaScript, something like described in this sample or this sample.
You can extract the OBJs for each element, but may need a big number of jobs. In this case, you need to run your code for .obj files.

Enyo 2.4 MVC Architecture

I am working on a application in Enyo which has several submodules, each is having its own model and view. Now among those modules, few modules have data that are same and a sync between those is done using binding which means a change in value of some data affects other module data.
I was thinking to make a common model for shared data and separate model for unique data in each module so that binding cannot play further, thus saving some crucial time. So far I have never seen a view to adapting two models altogether. This raises a question that whether is it possible for a view to have two models altogether?
Is there something in Enyo 2.4 MVC architecture that can help me?
I'm not sure I completely understand what you're trying to do, but it sounds like you might want to look at using enyo.ModelController. It will allow you to more easily "swap" a model for a particular component.
Also, you can associate any number of models with a component and bind it up how you like:
enyo.kind({
name: "MyView",
model: theSharedModel,
unique: theUniqueModel
bindings: [...]
});
You can easily do that. Perhaps place your common model onto the App object and your individual view models can live on their respective views. Bind the shared properties using ".app.sharedModel.property", for example.

CodeIgniter Model Call to Model

Im using CodeIgniter 2.0.2 and I noticed while calling a Model from within a Model, you dont need to load it.
For instance, in a Controller you need to write
$this->load->model('my_model');
$this->my_model->my_function();
But in a Model it can load just like this
$this->my_model->my_function();
Should i avoid writing my code like this, or is this safe?
I would avoid writing my code like this, but for a different reason.
Models are generally loaded from controllers, so it seems strange that you would need one model to call another one. Are you sure that there is not a better way to structure your code, such as having a model base class or using a helper for common functionality?

Resources