3 Replies Latest reply on Dec 9, 2010 10:20 AM by mardo00

    newmesh() example change with strange results

    mardo00 Level 1

      I am learning how to use the 3D capabilities of Director 11.5 and I made a slight change to the example given in the newmesh help page. Essentially I added another point to the pyramid shape of the example and created a two pyramid shape where they are connected at the bases. But when I rotate the object, it appears that some of the faces reflect light from the outside of the object and some reflect from the inside. Does anyone know what is happening? Here is my code. You can put this on a Shockwave 3D member. Thanks!

       

      on beginSprite me

       

        member("Shapes").resetWorld()

       

        nm = member("Shapes").newMesh("pyramid",8 , 6, 0, 0)


        nm.vertexList = [ \
          vector(  0,  0,  0), \
          vector( 40,  0, 40), \
          vector(  0, 40, 40), \
          vector(-40,  0, 40), \
          vector(  0,-40, 40), \
          vector(  0,  0, 60)]

        nm.face[1].vertices = [1, 2, 3]
        nm.face[2].vertices = [1, 3, 4]
        nm.face[3].vertices = [1, 4, 5]
        nm.face[4].vertices = [1, 5, 2]
        nm.face[5].vertices = [2, 3, 6]
        nm.face[6].vertices = [3, 4, 6]
        nm.face[7].vertices = [4, 5, 6]
        nm.face[8].vertices = [5, 2, 6]

       

        nm.generateNormals(#flat)
        nm.build()
        mod = member("Shapes").newModel("Pyramid1", nm)
      end