我有一个java程序,通过JAXB输出一个X3D文件。这是当前的输出。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<X3D version="1.0" profile="Full">
<head>
<meta name="Sim3DAnimator" content="jaxbtext.x3d"/>
</head>
<Scene>
<WorldInfo info="by Patrick R. Aquilone" title="Testing Simu 3D Animator"/>
<DirectionalLight ambientIntensity="1.0" intensity="1.0"/>
<Viewpoint orientation="0.0 0.0 0.0 90.0" position="0.0 10.0 100.0" description="SIM3D"/>
<Transform>
<Transform scale="1 1 1" translation="0.000000 0.000000 0.000000" DEF="person">
<Transform rotation="0 1 0 0.000000">
<Transform rotation="0 0 1 0.000000">
<Transform rotation="1 0 0 0.000000">
<Transform>
<MetadataString value="test"/>
<Transform scale="1 1 1" translation="0.000000 25.200000 0.000000">
<Shape>
<Sphere radius="8.0"/>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
</Shape>
</Transform>
<Transform rotation="0 0 1 1.570800" scale="1 1 1" translation="0.000000 13.200000 0.000000">
<Shape>
<Cylinder height="16.0" radius="1.0"/>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
</Shape>
</Transform>
<Transform scale="1 1 1" translation="0.000000 13.200000 0.000000">
<Shape>
<Cylinder height="16.0" radius="1.0"/>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
</Shape>
</Transform>
<Transform scale="1 1 1" translation="9.600000 3.000000 0.000000">
<MetadataString value="test-right-arm"/>
<Transform translation="0.000000 10.500000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="2.5"/>
</Shape>
</Transform>
<Transform translation="0.000000 0.000000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Cylinder height="21.0" radius="2.5"/>
</Shape>
</Transform>
<Transform translation="0.000000 -10.500000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="2.5"/>
</Shape>
</Transform>
</Transform>
<Transform scale="1 1 1" translation="-9.600000 3.000000 0.000000">
<MetadataString value="test-left-arm"/>
<Transform translation="0.000000 10.500000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="2.5"/>
</Shape>
</Transform>
<Transform translation="0.000000 0.000000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Cylinder height="21.0" radius="2.5"/>
</Shape>
</Transform>
<Transform translation="0.000000 -10.500000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="2.5"/>
</Shape>
</Transform>
</Transform>
<Transform scale="1 1 1" translation="5.000000 -24.000000 0.000000">
<MetadataString value="test-right-leg"/>
<Transform translation="0.000000 10.500000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="2.5"/>
</Shape>
</Transform>
<Transform translation="0.000000 0.000000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Cylinder height="21.0" radius="2.5"/>
</Shape>
</Transform>
<Transform translation="0.000000 -10.500000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="2.5"/>
</Shape>
</Transform>
</Transform>
<Transform scale="1 1 1" translation="-5.000000 -24.000000 0.000000">
<MetadataString value="test-left-leg"/>
<Transform translation="0.000000 10.500000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="2.5"/>
</Shape>
</Transform>
<Transform translation="0.000000 0.000000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Cylinder height="21.0" radius="2.5"/>
</Shape>
</Transform>
<Transform translation="0.000000 -10.500000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="2.5"/>
</Shape>
</Transform>
</Transform>
<Transform scale="1 1 1" translation="0.000000 0.000000 0.000000">
<MetadataString value="test-torso"/>
<Transform translation="0.000000 12.000000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="5.0"/>
</Shape>
</Transform>
<Transform translation="0.000000 0.000000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Cylinder height="24.0" radius="5.0"/>
</Shape>
</Transform>
<Transform translation="0.000000 -12.000000 0.000000">
<Shape>
<Appearance>
<Material ambientIntensity="0.5" diffuseColor="0.500000 0.500000 0.500000"/>
</Appearance>
<Sphere radius="5.0"/>
</Shape>
</Transform>
</Transform>
</Transform>
</Transform>
</Transform>
</Transform>
<PositionInterpolator keyValue=" 0 0 0 10 0 0 20 0 0 30 0 0 40 0 0 50 0 0 60 0 0 70 0 0 80 0 0 90 0 0 100 0 0 90 0 0 80 0 0 70 0 0 60 0 0 50 0 0 40 0 0 30 0 0 20 0 0 10 0 0" key=" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19" DEF="person-position"/>
<TimeSensor cycleInterval="1.0" loop="true" DEF="person-time"/>
<ROUTE fromNode="person-time" fromField="fraction_changed" toNode="person-position" toField="set_fraction"/>
<ROUTE fromNode="person-position" fromField="value_changed" toNode="person" toField="set_translation"/>
</Transform>
</Transform>
</Scene>
</X3D>
我的问题是你可以看到插值占20个点,但是当它运行时它只运行了一半,然后快速回到开头。我不明白为什么它会在第10个间隔停止。我知道我错过了什么,但是什么?
顺便说一句,我是新人,所以你看到我能解决的任何问题,请继续告诉我。提前致谢。
答案 0 :(得分:0)
fraction_changed 输出0到1之间的值.IndsetInterpolator的键具有从0到20开始的整数值。这意味着只有第一个(0)和第二个( 1)每当TimeSensor开始/结束时,值都将处于活动状态。基本上你的变换将被翻译5次到(0,0,0)和5次翻译成(10,0,0)。
要实现您想要的功能,您必须将键数组更改为: 关键[0 0.05 0.10 0.15 .... 0.95 1]
或将 person-time.time 路由到person-position.set_fraction。这将通过所有键值一次。
它应该以这种方式工作。