1 Reply Latest reply on Oct 3, 2011 4:52 AM by drcricket82

    Vector3 not defined

    drcricket82

      I have a simple PDF with a single button and a 3D view with a mesh object in it. The button triggers some javascript code:

       

      pageIndex = this.pageNum;

      annotIndex = 0;

      c3d = getAnnots3D( pageIndex )[annotIndex ].context3D;

      obj1 = c3d.scene.meshes.getByIndex( 0 );

      obj1.transform.rotateAboutXInPlace(Math.PI / 60);

       

      This works fine. Now, when I want to translate the object, I need a Vector3 object. So I add a Vector3:

       

      vec1 = new Vector3(10.0, 0.0, 0.0);

       

      And when I try to run I get:

       

      Vector3 is not defined

      5:AcroForm:myButton:Annot1:MouseUp:Action1Exception in line 5 of function top_level, script AcroForm:myButton:Annot1:MouseUp:Action1

       

      I came across many examples where people just define a new Vector3 object. I hope someone can tell me what's wrong here. Thanks a lot!

       

      cheers

      Peter

        • 1. Re: Vector3 not defined
          drcricket82 Level 1

          Problem solved. For anyone coming across this post and coping with the same problem:

           

          The button runs its javascript from the Form Level, so that's why we have to get to the c3d context (for the same reason we get the context in the first place... doh). The Vector3 object is part of that context, so what DOES work is:

           

          vec1 = new c3d.Vector3(10.0, 0.0, 0.0);

           

          Yay!