Closed microaaron closed 2 years ago
https://www.web3d.org/x3d/tooltips/X3dTooltips.html#ProtoBody explains that only the first root node is rendered. Since the ProtoInstance needs to be a single node in the scene graph, I think this is the only option. Do the examples work in other x3d browsers ?
The easy workaround is wrap all into a single group.
BS Contact and view3dscene support TimeSensor,PositionInterpolator,ROUTE in the second group, but only BS Contact renders the second group. Anyway, I should abide by the rule. Thanks.
Interesting. Perhaps BS Contact wraps everything internally into a single node, probably a group. But still uses the first node as the type.
Yes, abiding by the rule is important. As author you can always start with a group. Worth noting is that the ability to "stash" additional nodes after the first node can provide valuable capabilities. As a simple example, if the first node is an IndexedFaceSet (or some other geometry node), then follow-on nodes within the ProtoBody can animate it. Then the entire ProtoInstance can appear within Shape, like any other geometry node. (Can't do that with a Group as topmost first node.) This gives authors great expressive power - and another reason why the "X" in X3D Graphics is Extensible.
shows how in x3dom additional (helper) nodes are wrapped internally in a Switch node. This Switch node does not have a parent, eg. is a root node which does not render. I think we determined at the time that this was a good solution to get the desired behaviour, and I cannot think of a better solution now. Perhaps castle or x_ite does it the same way.
Example1: All shapes in the first group https://jsitor.com/RSdozbEw6 Example2: Put the blue box into the second group https://jsitor.com/-MsWz876g . The blue box disappeared. Example3: TimeSensor,PositionInterpolator,ROUTE in the second group https://jsitor.com/T7FlDL6IN. They still work.
Example2.x3d:
Example3.x3d: