When a ThingJS scene is loaded with a campus, the system automatically creates a campus, a building, a floor, a room and other objects, which naturally divide the scene into different levels.
CamBuilder lets you build and export a campus that can be loaded in a ThingJS scenario.
Click Add image description (up to 60 words) to complete the scene construction and export the ThingJS scenario package (.tjs) to the ThingJS development platform https://www.thingjs.com/ for use. In ThingJS, all lengths and distances are measured in meters, so when setting up a scene, you need to build parks, buildings, floors and rooms according to the actual dimensions. If the displayed objects are imported by users, model them based on the actual size.
When ThingJS is launched using an App, it creates a three-dimensional space, which we call a scene, in which we can create objects such as parks, buildings, vehicles, sensors and so on.
CamBuilder lets you edit and output a park that can be loaded in a ThingJS scenario. When creating the App, the URL we pass in is the address of the park to be created.
CamBuilder connected with ThingJS
Objects created in CamBuilder become independent managed objects that can be read or modified by the program only after the UserID, Name, or custom attributes are edited and imported into ThingJS. And UserID and Name in CamBuilder correspond to objects in ThingJS.
In a scenario, it is possible to add multiple separate campuses, each of which is an object of the THING.Campus class, which we implement through the “app.create” interface.
var app = new THING.App();
var campus1 = app.create({
type: “Campus”,
url: “models/storehouse”,
complete: function (ev) {
console.log(“Campus created: ” + ev.object.id);
}
});
var campus2 = app.create({
type: “Campus”,
url: “models/chinesehouse”,
position: [50, 0, 0],
complete: function (ev) {
console.log(“Campus created: ” + ev.object.id);
}
});
CamBuilder lets you edit and output a park that can be loaded in a ThingJS scenario. When creating the App, the URL we pass in is the address of the park to be created.
After building a campus with CamBuilder, we can use plug-ins to set the location of the scene on the map.
Select the right place on the map and save, and the scenes in CamBuilder are automatically synchronized to the same ThingJS account.
After the scene is synchronized, we can get the longitude and latitude data that the scene is placed on the map through the code.
var app = new THING.App();
var campus1 = app.create({
type: “Campus”,
url: “models/storehouse”,
complete: function (ev) {
console.log(“Campus created: ” + ev.object.id);
}
});
var campus2 = app.create({
type: “Campus”,
url: “models/chinesehouse”,
position: [50, 0, 0],
complete: function (ev) {
console.log(“Campus created: ” + ev.object.id);
}
});
In ThingJS, the park can be placed in the corresponding position of the earth. The examples of longitude and latitude data mentioned above are as follows:
var app = new THING.App();
var campus1 = app.create({
type: “Campus”,
url: “models/storehouse”,
complete: function (ev) {
console.log(“Campus created: ” + ev.object.id);
}
});
var campus2 = app.create({
type: “Campus”,
url: “models/chinesehouse”,
position: [50, 0, 0],
complete: function (ev) {
console.log(“Campus created: ” + ev.object.id);
}
}); Of course, the longitude and latitude data can also be directly used in CityBuilder. When we use CityBuilder, we will place the scene at a certain location on the earth, and then we can arrange the scene according to the longitude and latitude obtained by us.
After the development interaction function of the scene is completed, the scene can be seen in the corresponding position by selecting the map background during the scene preview.
When the campus is loaded in the ThingJS scenario, the scene automatically creates the campus, building, floor, room, and other objects added to the CamBuilder. These objects are not scattered independently in the scene, they are related to each other, forming a tree structure that builds the hierarchy of the scene.
In the ThingJS scenario, each object can be accessed by children and parent objects.