Hi @andreasplesch,
Glad some people think about a vrml importer tool. Do you have also some project you made in vrml? I whish there was one when I start restoring my worlds. As I didn’t know yet well babylon format and almost forgot vrml one I didn’t try to make such a tool which can be quite complex.
As far as I remember my vrml file were generated by tool like Internet Space Builder or CosmoWorld, I didn’t make the vrml object directly inside the code, only some routing or scriptting and all the others things like models, texture mapping, object coordinate, cloning and so one are all made by visual editor. That’s why I dive quickly into Blender which have a babylon export as addon.
What I can say about DEF/USE is that if I want to have the same result of cloning in babylon export as vrml file have, in Blender I use Alt+D ( Duplicate Linked ) on an object to duplicate it. Shift+D will make a copy which is different.
For example the cloning of sheep in floating islands ( Sheep2 is a clone of Sheep )
VRML File :
DEF Sheep2 Transform { # children: 2
translation 8.64301 11.7014 -1.32886
rotation -9.78757e-008 1 1.02931e-006 2.72272
scaleOrientation -0.314411 0.314406 -0.895709 1.6807
scale 0.7093 1 0.999997
children [
USE Sheep
Sound {
minFront 100000
maxFront 100000
minBack 100000
maxBack 100000
source DEF _Audio1 AudioClip {
url "01.wav"
}
}
DEF _Touch1 TouchSensor {
}
]
ROUTE _Touch1.touchTime TO _Audio1.startTime
}
And in babylon file sheep2 is inside an array of sheep called instances :
"instances": [
{
"name": "sheep2",
"position": [
67.8977,
6.8455,
46.7354
],
"rotation": [
-1.5708,
2.5246,
0
],
"scaling": [
1.2346,
1.2346,
1.2346
],
"freezeWorldMatrix": false,
"tags": "sheep",
"checkCollisions": false,
"pickable": true
},
As you see there was a touchSensor on vrml file who play directly the sound of sheep, but not on babylon one, I make the script outside in the javascript by looking at sheep tags
// sheeps
let sheeps = scene.getMeshesByTags("sheep");
for (sheep of sheeps) {
sheep.isPickable = true;
sheep.actionManager = new BABYLON.ActionManager(scene);
sheep.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger, function () {
let ready = checkAudioContext();
if(ready) {
sheepSound.stop();
sheepSound.play();
}
}));
}
I don’t know yet too much about DOM events and the triggers, hope someone here can help you more on that part. If you have any question don’t hesitate, I will be happy to help.
If you need to compare vrml/babylon format on a project feel free to check original one :
https://www.mondesvirtuels.com/wrls/worlds/iles/iles.wrl ( need to unzip it )
virtualworlds/islands/babylon at main · deimos411/virtualworlds · GitHub
Have a good day,