Grouping Your Shapes

Name • Attributes

A Box, a Sphere and a Cylinder that have been individually transformed (translation). Then all three have been grouped together and transformed (translation, then rotated along the Y-axis by 0.50 radians) as a group.

A Group node accompanied by another node such as Transform or a lighting object allows you to affect multiple nodes at once.

 

Rotate the vrignette to view the geometry.

<x3d>

<scene>

<worldInfo title="X3D Group Example">
</worldInfo>

<navigationInfo headlight="true">
</navigationInfo>

<viewpoint position="0.0 3.5 20.0" centerOfRotation="0.0 0.0 0.0">
</viewpoint>

<!-- Group Transform -->
<transform translation="1.0 3.5 0.0" rotation="1 1 0 0.4">
<group>
<transform>
<shape>
<appearance>
<material diffuseColor="1.0 1.0 0.0" specularColor="0.20 0.20. 0.20" shininess="0.10">
</material>
</appearance>
<box size="3.0 3.0 3.0" solid="false">
</box>
</shape>
</transform>

<transform translation="-5.0 0.0 0.0">
<shape>
<appearance>
<material diffuseColor="0.0 1.0 1.0" specularColor="0.20 0.20 0.20" shininess="0.10">
</material>
</appearance>
<sphere radius="1.75" solid="false">
</sphere>
</shape>
</transform>

<transform translation="5.0 0.0 0.0">
<shape>
<appearance>
<material diffuseColor="1.0 1.0 1.0" specularColor="0.20 0.20 0.20" shininess="0.10">
</material>
</appearance>
<cylinder top="true" bottom="true" side="true" height="3.0" radius="1.5">
</cylinder>
</shape>
</transform>
</group>
</transform>

<background skyColor="0.75 0.15 0.75" groundColor="0.25 0.5 0.0">
</background>

</scene>

</x3d>