Hello Everyone, Is there a way to open a new VRML world, add a background to the scene, and add different 3D Transform nodes depending on an indexing parameter passed from a MATLAB just using a command prompt? To clarify, using the following command requires the file to exist upfront to create the VRML world. Is it possible to create even 'filename' if it does not exist? >> myworld = vrworld('filename', 'new'); The following command requires the existence of the node 'node_name' in the 'filename' to further manipulate the node object. What if we want to add this node depending on an input (say if i==1 insert 'plane.wrl' to the VRML world else insert 'helicopter.wrl' which are located in some folder). >> mynode = vrnode(vrworld_object, 'node_name')
John Michell answered .
2025-11-20
w = vrworld(''); % create an empty world and open it
open(w);
% ... add any nodes if desired ...
save(w, 'myworld.wrl'); % save under a new name
close(w);
You can add nodes to an existing open world (either loaded from a file or created as above) like this:
t1 = vrnode(w, 'MyTransform', 'Transform'); % add a Transform on the root t2 = vrnode(t1, 'children', 'AnotherTransform', 'Transform'); % add child to t1