Transforming Your Shapes

Transform • Attributes

A Box, a Sphere and a Cylinder at different points in the scene. All three shapes have a default location of 0,0,0 but have been translated to their current position.

Transform node is similar in function to the SVG 'transform' attribute.

 

Rotate the vrignette to view the geometry.

<x3d>

<scene>

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

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

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

<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 translation="-5.0 3.0  -3.5">
<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.5" solid="false">
</sphere>
</shape>
</transform>

<transform translation="5.0 4.0 -10.5">
<shape>
<appearance>
<material diffuseColor="1.0 0.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>

<background skyColor="0.20 0.20 0.20" groundColor="0.20 0.20 0.20">
</background>

</scene>

</x3d>