所以在过去的几个小时里,我一直在尝试让我从这里得到的这个沙发模型在它的 x 轴上旋转 360*,但没有成功。我一直在使用的代码如下。沙发模型本身包含一些不同的对象。就像手臂、腿和木臂一样,我试图让模型中的所有对象在 x 轴上旋转。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Interchange' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation=' http://www.web3d.org/specifications/x3d-3.0.xsd '>
<head>
<meta name='title' content='Sofa.x3d' />
<meta name='description' content='Sofa' />
<meta name='creator' content='Seksit Siripala' />
<meta name='created' content='September 10, 2002' />
<meta name='modified' content='October 11, 2002' />
<meta name='identifier' content=' https://savage.nps.edu/Savage/Buildings/HouseSeksitSiripala/Sofa.x3d ' />
<meta name='generator' content='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit' />
<meta name='license' content='../../license.html' />
</head>
<!--a
Index for DEF nodes:Aarm, leg, woodarm
-->
<Scene>
<Transform DEF='Sofa'>
<Transform translation='0.0 0.0 3.0'>
<Shape DEF='leg'>
<Appearance>
<Material diffuseColor='0.2 0.1 0.0' />
</Appearance>
<Cylinder height='0.5' radius='0.2' />
</Shape>
</Transform>
<Transform translation='0.0 0.0 -3.0'>
<Shape USE='leg' />
</Transform>
<Transform translation='-2.0 0.0 -3.0'>
<Shape USE='leg' />
</Transform>
<Transform translation='-2.0 0.0 3.0'>
<Shape USE='leg' />
</Transform>
<Transform rotation='0.0 0.0 1.0 0.1' translation='-1.0 0.3 0.0'>
<Shape>
<Appearance>
<Material diffuseColor='0.1 0.2 0.5' />
</Appearance>
<Box size='2.5 0.5 7.0' />
</Shape>
</Transform>
<Transform rotation='0.0 0.0 1.0 0.1' translation='-1.0 0.5 3.5'>
<Group DEF='arm'>
<Shape>
<Appearance>
<Material diffuseColor='0.1 0.2 0.5' />
</Appearance>
<Box size='2.5 0.3 0.3' />
</Shape>
<Transform rotation='0.0 0.0 1.0 -1.5' translation='0.0 0.2 0.0'>
<Shape>
<Appearance>
<Material diffuseColor='0.1 0.2 0.5' />
</Appearance>
<Cylinder height='3.0' radius='0.2' />
</Shape>
</Transform>
</Group>
</Transform>
<Transform rotation='0.0 0.0 1.0 -1.4' translation='-1.0 0.7 3.5'>
<Shape DEF='woodarm'>
<Appearance>
<Material diffuseColor='0.2 0.1 0.0' />
</Appearance>
<Cylinder height='3.2' radius='0.1' />
</Shape>
</Transform>
<Transform rotation='0.0 0.0 1.0 -1.4' translation='-1.0 0.7 -3.5'>
<Shape USE='woodarm' />
</Transform>
<Transform rotation='0.0 0.0 1.0 0.1' translation='-1.0 0.5 -3.5'>
<Group USE='arm' />
</Transform>
<Transform rotation='0.0 0.0 1.0 0.4' translation='-2.2 0.8 0.0'>
<Shape>
<Appearance>
<Material diffuseColor='0.1 0.2 0.5' />
</Appearance>
<Box size='0.3 1.5 6.5' />
</Shape>
</Transform>
<Transform rotation='0.0 0.0 1.0 0.1' translation='-1.0 0.4 0.0'>
<Shape>
<Appearance>
<Material diffuseColor='0.1 0.2 0.5' />
</Appearance>
<Box size='2.5 0.5 6.5' />
</Shape>
<Transform rotation='1.0 0.0 0.0 1.5707964' translation='1.15 0.0 0.0'>
<Shape>
<Appearance>
<Material diffuseColor='0.1 0.2 0.5' />
</Appearance>
<Cylinder height='6.5' radius='0.25' />
</Shape>
</Transform>
</Transform>
</Transform>
<timeSensor DEF="clock" cycleInterval='5' loop='true'></timeSensor>
<OrientationInterpolator DEF='moveSofa' key='0 .25 .5 .75 1' keyValue='0 1 0 0 0 1 0 1.57079 0 1 0 3.14159 0 1 0 4.71239 0 1 0 6 '>
</orientationInterpolator>
<ROUTE fromNode="clock" fromField='fraction_changed' toNode='moveSofa' toField='set_fraction'></ROUTE>
<ROUTE fromNode='moveSofa' fromField='value_changed' toNode='Sofa' toField='set_rotation'></ROUTE>
</Scene>
</X3D>
<!--
Index for DEF nodes: arm, leg, woodarm
-->
<!-- Tag color codes (X3D, XML terminology): <Node DEF='idName' field='value'/> <Element DEF='idName' attribute='value'/> -->