0

I have wireframe cubes in an X3D file. I am trying to tilt the cubes at a 15 degree axis and rotate them continuously. However, when I try rotating the object, it returns to its original (untilted) position and begins to rotate.

This is the snippet of code that I am using to rotate the one of the cubes.

    <!DOCTYPE html>
    <html>
  <head>
    <meta http-equiv='Content-Type' content='text/html;charset=utf- 
   8'></meta>
    <link rel='stylesheet' type='text/css' 
    href='http://www.x3dom.org/x3dom/release/x3dom.css'></link>
    <script type='text/javascript' 
    src='http://www.x3dom.org/x3dom/release/x3dom.js'></script>
  </head>
  <body>
    <x3d id='someUniqueId' showStat='false' showLog='false' x='0px' 
    y='0px' width='400px' height='400px'>
      <scene>
        <navigationInfo avatarSize='0.25 1.75 0.75' headlight='false' 
    type='"EXAMINE" "ANY"'></navigationInfo>
        <background DEF='WO_World' groundColor='0.051 0.051 0.051' 
    skyColor='0.051 0.051 0.051'></background>
        <transform DEF='Cube_TRANSFORM' rotation='-0.735729 0.478906 
    0.478906 1.87298'>
          <transform DEF='Cube_ifs_TRANSFORM'>
            <group DEF='group_ME_Cube'>
              <shape>
                <appearance></appearance>
                <indexedFaceSet solid='false' texCoordIndex='0 1 2 3 -1 4 5 6 7 -1 8 9 10 11 -1 12 13 14 15 -1 16 17 18 19 -1 20 21 22 23 -1 24 25 26 27 -1 28 29 30 31 -1 32 33 34 35 -1 36 37 38 39 -1 40 41 42 43 -1 44 45 46 47 -1 48 49 50 51 -1 52 53 54 55 -1 56 57 58 59 -1 60 61 62 63 -1 64 65 66 67 -1 68 69 70 71 -1 72 73 74 75 -1 76 77 78 79 -1 80 81 82 83 -1 84 85 86 87 -1 88 89 90 91 -1 92 93 94 95 -1 96 97 98 99 -1 100 101 102 103 -1 104 105 106 107 -1 108 109 110 111 -1 112 113 114 115 -1 116 117 118 119 -1 120 121 122 123 -1 124 125 126 127 -1 128 129 130 131 -1 132 133 134 135 -1 136 137 138 139 -1 140 141 142 143 -1 144 145 146 147 -1 148 149 150 151 -1 152 153 154 155 -1 156 157 158 159 -1 160 161 162 163 -1 164 165 166 167 -1 168 169 170 171 -1 172 173 174 175 -1 176 177 178 179 -1 180 181 182 183 -1 184 185 186 187 -1 188 189 190 191 -1' coordIndex='16 17 8 0 -1 17 16 1 9 -1 17 18 12 8 -1 18 17 9 13 -1 18 19 4 12 -1 19 18 13 5 -1 19 16 0 4 -1 16 19 5 1 -1 20 21 4 6 -1 21 20 7 5 -1 21 22 12 4 -1 22 21 5 13 -1 22 23 14 12 -1 23 22 13 15 -1 23 20 6 14 -1 20 23 15 7 -1 24 25 12 14 -1 25 24 15 13 -1 25 26 8 12 -1 26 25 13 9 -1 26 27 10 8 -1 27 26 9 11 -1 27 24 14 10 -1 24 27 11 15 -1 28 29 2 10 -1 29 28 11 3 -1 29 30 6 2 -1 30 29 3 7 -1 30 31 14 6 -1 31 30 7 15 -1 31 28 10 14 -1 28 31 15 11 -1 32 33 0 2 -1 33 32 3 1 -1 33 34 4 0 -1 34 33 1 5 -1 34 35 6 4 -1 35 34 5 7 -1 35 32 2 6 -1 32 35 7 3 -1 36 37 8 10 -1 37 36 11 9 -1 37 38 0 8 -1 38 37 9 1 -1 38 39 2 0 -1 39 38 1 3 -1 39 36 10 2 -1 36 39 3 11 -1'>
                  <coordinate DEF='coords_ME_Cube' point='0.971133 0.971133 0.971133 1.02887 1.02887 1.02887 0.971133 0.971133 -0.971133 1.02887 1.02887 -1.02887 0.971133 -0.971133 0.971133 1.02887 -1.02887 1.02887 0.971133 -0.971133 -0.971133 1.02887 -1.02887 -1.02887 -0.971133 0.971133 0.971133 -1.02887 1.02887 1.02887 -0.971133 0.971133 -0.971133 -1.02887 1.02887 -1.02887 -0.971133 -0.971133 0.971133 -1.02887 -1.02887 1.02887 -0.971133 -0.971133 -0.971133 -1.02887 -1.02887 -1.02887 0.95 0.95 1 -0.95 0.95 1 -0.95 -0.95 1 0.95 -0.95 1 0.95 -1 -0.95 0.95 -1 0.95 -0.95 -1 0.95 -0.95 -1 -0.95 -1 -0.95 -0.95 -1 -0.95 0.95 -1 0.95 0.95 -1 0.95 -0.95 -0.95 0.95 -1 0.95 0.95 -1 0.95 -0.95 -1 -0.95 -0.95 -1 1 0.95 -0.95 1 0.95 0.95 1 -0.95 0.95 1 -0.95 -0.95 -0.95 1 -0.95 -0.95 1 0.95 0.95 1 0.95 0.95 1 -0.95'></coordinate>
                  <textureCoordinate point='0.625 0.5 0.875 0.5 0.875 0.5 0.625 0.5 0.875 0.5 0.625 0.5 0.625 0.5 0.875 0.5 0.875 0.5 0.875 0.75 0.875 0.75 0.875 0.5 0.875 0.75 0.875 0.5 0.875 0.5 0.875 0.75 0.875 0.75 0.625 0.75 0.625 0.75 0.875 0.75 0.625 0.75 0.875 0.75 0.875 0.75 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.5 0.375 0.75 0.625 0.75 0.625 0.75 0.375 0.75 0.625 0.75 0.375 0.75 0.375 0.75 0.625 0.75 0.625 0.75 0.625 1 0.625 1 0.625 0.75 0.625 1 0.625 0.75 0.625 0.75 0.625 1 0.625 1 0.375 1 0.375 1 0.625 1 0.375 1 0.625 1 0.625 1 0.375 1 0.375 1 0.375 0.75 0.375 0.75 0.375 1 0.375 0.75 0.375 1 0.375 1 0.375 0.75 0.375 0 0.625 0 0.625 0 0.375 0 0.625 0 0.375 0 0.375 0 0.625 0 0.625 0 0.625 0.25 0.625 0.25 0.625 0 0.625 0.25 0.625 0 0.625 0 0.625 0.25 0.625 0.25 0.375 0.25 0.375 0.25 0.625 0.25 0.375 0.25 0.625 0.25 0.625 0.25 0.375 0.25 0.375 0.25 0.375 0 0.375 0 0.375 0.25 0.375 0 0.375 0.25 0.375 0.25 0.375 0 0.125 0.5 0.375 0.5 0.375 0.5 0.125 0.5 0.375 0.5 0.125 0.5 0.125 0.5 0.375 0.5 0.375 0.5 0.375 0.75 0.375 0.75 0.375 0.5 0.375 0.75 0.375 0.5 0.375 0.5 0.375 0.75 0.375 0.75 0.125 0.75 0.125 0.75 0.375 0.75 0.125 0.75 0.375 0.75 0.375 0.75 0.125 0.75 0.125 0.75 0.125 0.5 0.125 0.5 0.125 0.75 0.125 0.5 0.125 0.75 0.125 0.75 0.125 0.5 0.375 0.5 0.625 0.5 0.625 0.5 0.375 0.5 0.625 0.5 0.375 0.5 0.375 0.5 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0.75 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.75 0.375 0.75 0.375 0.75 0.625 0.75 0.375 0.75 0.625 0.75 0.625 0.75 0.375 0.75 0.375 0.75 0.375 0.5 0.375 0.5 0.375 0.75 0.375 0.5 0.375 0.75 0.375 0.75 0.375 0.5 0.375 0.25 0.625 0.25 0.625 0.25 0.375 0.25 0.625 0.25 0.375 0.25 0.375 0.25 0.625 0.25 0.625 0.25 0.625 0.5 0.625 0.5 0.625 0.25 0.625 0.5 0.625 0.25 0.625 0.25 0.625 0.5 0.625 0.5 0.375 0.5 0.375 0.5 0.625 0.5 0.375 0.5 0.625 0.5 0.625 0.5 0.375 0.5 0.375 0.5 0.375 0.25 0.375 0.25 0.375 0.5 0.375 0.25 0.375 0.5 0.375 0.5 0.375 0.25'></textureCoordinate>
                </indexedFaceSet>
              </shape>
            </group>
          </transform>
        </transform>
        <transform DEF='Light_TRANSFORM' rotation='-0.498084 -0.762016 -0.413815 1.51388' translation='-4.07624 5.90386 1.00545'>
          <pointLight DEF='LA_Light' radius='30'></pointLight>
        </transform>
        <transform DEF='Camera_TRANSFORM' rotation='-0.098233 -0.968789 -0.227591 2.34949' translation='-7.35889 4.95831 -6.92579'>
          <viewpoint DEF='CA_Camera' position='-0 -0 100' fieldOfView='0.05'></viewpoint>
        </transform>
    <timeSensor DEF='clock' cycleInterval='8' loop='true'></timeSensor>
        <orientationInterpolator DEF='spinThings' key='0 0.25 0.5 0.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.28317'></orientationInterpolator>
 
        <ROUTE fromNode='clock' fromField='fraction_changed' toNode='spinThings' toField='set_fraction'></ROUTE>
        <ROUTE fromNode='spinThings' fromField='value_changed' toNode='Cube_TRANSFORM' toField='set_rotation'></ROUTE>
      </scene>
    </x3d>
  </body>
</html>
JetK
  • 1
  • 1
  • It would help if you posted a larger snippet of code. What you have posted does not show how you perform the tilt at a 15 degree axis, the orientationinterpolator you have posted rotates about the y axis – Vincent Marchetti Feb 17 '22 at 22:48
  • I uploaded the full code. – JetK Feb 21 '22 at 02:18

1 Answers1

0

From the code it is apparent that the transform node with the DEF value of Cube_TRANSFORM is the node that tilts the cubes at the 15 degree axis. However, the second ROUTE statement is replacing this rotation with the interpolated and rotation axis, which for all interpolated values is along the y axis.

If you change the second ROUTE statement so that the toNode value is Cube_ifs_TRANSFORM then the static tilt by 15 degrees will be preserved, and this might be the visual animation you want.

Vincent Marchetti
  • 4,768
  • 3
  • 18
  • 8