I want the resource manager to load the model data in my json, but I don’t know how to use the assetsManger array
Difficult to tell from just an image of code and parts of the code are clipped on the image. You could see if you could create a playground. You can load your external assets - have a read of Using External Assets - Babylon.js Documentation.
IMHO it appears you have some blocks of code misplaced.
Also as position is a vector position/5000 is not possible it should be position.scale(1/5000)
In the following example I am making an assumption that there are many files names with their URLs in an url array and each file contains many models
var assetsManager = new BABYLON.AssetsManager(scene);
for(var index=0; index<jy_length; index++) {
var meshTask = assetsManager.addMeshTask("task" + index, "", url[index], fileName[index]);
meshTask.onSuccess = function (task) {
for (var m = 0; m < task.loadedMeshes.length; m++) {
task.loadedMeshes[m].position.scaleInPlace(1 / 5000);
}
}
}
assetsManager.onFinish = function (tasks) {
engine.runRenderLoop(function () {
scene.render();
});
assetsManager.load();
I tried it yesterday!But unfortunately, the problem of load and the problem of render resulted in my model not being loaded, and I have been warning
Local relative to what frame of reference. Do your models have a parent?
I don’t think so. The models are all individually
What happens if you just let the models load and do not change the position?
- If it’s just loading the model, it shouldn’t be in the position, it’s also messy
To help you further please use Using External Assets - Babylon.js Documentation to load ONE file using your code into the playground.
His example seems too simple
It is YOUR code in a playground we need.
By the way, do you know which camera can be used to set the camera near the model? But my model is written in js, and the camera is in HTML script
I am very sorry but without an example of your code in a playground (or access to a live example somewhere) I do not have the ability to help any more. Perhaps others might be able to.
I’ve already solved that problem, because the coordinates in json are not assigned that way, they should be subscripted
My current model position has been assigned, because it is more than 30,000 coordinates, out of my skybox, but it seems that skybox cannot set such a large position, and, I pulled the camera nearby to have a look, the model seems to be still messy, I do not know whether it is because of the world coordinates or local coordinates
Glad to hear that your original question has been solved. Please mark this topic as solved.
Answers about positioning should be left to the thread that asks about coordinates.