1. A concise explanation of the problem you're experiencing.
I'm working on a mobile app with Cesium and cordova.
i'm trying to load 3D model (made with Contextcapture, file format:json) from my mobile (data are in the memory of the phone) but, no ways, it doesn't work.
Is there a link, a written code or a tool that can be use to load the model on a mobile?
I tried with some data (that aren't complet model) and the code works. Solution?
The problem is that i've based my code from your blog "An Introduction to Cesium Android Apps with Cordova" but i didn't work. By the way, the code that i've post juste upper in my first message come from there.
I’m guessing since this is a .json file from contextCapture this is exporting a 3D Tileset. You’ll load it like this example, instead of the following block:
var heightOffsetB1B2=15.8
var longOffsetB1B2 = 0.00000091;
var latOffsetB1B2=0.00000035;
var uri =this.result;
viewer.entities.add({
url : uri,
position :Cesium.Cartesian3.fromDegrees (4.33763, 50.69359,20),
billboard : {
image : pinBuilder.fromText(‘test’, Cesium.Color.RED, 48),
verticalOrigin : Cesium.VerticalOrigin.BOTTOM
}
});
I've tried your code in the example. It seems that it didn't work, nothing appears (not even error log file if there where a problem).
Yes it's a json file from context capture. Currently, it's reference system is Lambert 72 (EPSG 31370) and not WGS 84. So i've tried to modify the code like on the computer software.
And more, i want to select/import the file manually (not charge automatically the file when the program run).
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0, -2.0, 0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
// Position tileset
var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude,cartographic.height);
var cartographic_longitude= cartographic.longitude -longOffsetr3;
var cartographic_latitude= cartographic.latitude -latOffsetr3;
var offset = Cesium.Cartesian3.fromRadians(cartographic_longitude, cartographic_latitude, heightOffsetr3);
var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
console.log(tileset.modelMatrix);
``
And perhaps log the tileset to make sure it’s loading. If nothing, not even the error message, is being outputted to the console, it sounds like you are having a silent failure in your then function.
Yes i'm in accord with you. Seems to have a problem to load the 3D json file.
However, the "load" manner that i used is the same then the one to upload 3D tile with Cesium on Firefox. It's a bit strange..
Do you (or anyone else of your team) know a way (which supposed to work) to import 3D tile? Using another file extension perhaps? (or convert JSON in gltf maybe?)
Thanks for the answer. I've looked but there is no great change with the server.js that i've used. It seems to have some more tileset file format accepted.
The rest is identical I think it won't change the import of 3D tiles on mobile, but i gonna try.
I think the only difference may be that the way server.js serves 3d-tiles json files supports gzipped tilesets, and there’s a good chance your tileset is gzipped.
Hello Yohann, i have the same problem with the 3d tile, i solved by loading the model in gltf, but in this format the model is too heavy and the app crashes.