edit *.wrl file, add a new node

Illustration
Steven - 2021-08-13T14:31:26+00:00
Question: edit *.wrl file, add a new node

I tried to add a new transform node in my virtual world object. With Matlab function vrnode I have been able to obtain the handle and set some of existing field of the virtual world object. I am wondering HOW can I add a new transform node under the existing transform node via Matlab directly without manipulating the raw *.wrl file.   Below is the list of fields available. It seems to be that the addChildren field here shall add a new child node to the existing node, so I tried syntax to use the addChildren field, but none of them works. Is it possible? Below is the list return by fields function. Field Access Type Sync ----------------------------------------------------------- addChildren eventIn MFNode off removeChildren eventIn MFNode off children exposedField MFNode off center exposedField SFVec3f off rotation exposedField SFRotation off scale exposedField SFVec3f off scaleOrientation exposedField SFRotation off translation exposedField SFVec3f off bboxCenter field SFVec3f off bboxSize field SFVec3f off  

Expert Answer

Profile picture of Neeta Dsouza Neeta Dsouza answered . 2025-11-20

as the parent field, you should use the children field, not addChildren, which is an event. Like in the following code snippet, based on the shipping vrbounce example:

 

w = vrworld('vrbounce');
open(w);
parenttransform = w.Ball;
newtransform = vrnode(parenttransform, 'children', 'NewTransform', 'Transform')

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!