Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

289
Views
How Can I make a 3D object move in JavaScript Annot3D PDF?

I am trying to have a 3d object move either by Vector3 or Matrixes. Documentation is vague.

//////Code/////////

myKeyHandler.onEvent = function( event )
{
console.println( "Key pressed with code: " + event.characterCode );


if(event.characterCode === 119){

//Up or W
v1 = new Vector3(0.0,1.0,0.0);
getAnnots3D(0)[0].context3D.sceen.nodes.getByName("node").transform.translate(v1);
}

if(event.characterCode === 97){

//left or A
v2 = new Vector3(1.0,0.0,0.0);
getAnnots3D(0)[0].context3D.sceen.nodes.getByName("node").transform.translate(v2);
}

if(event.characterCode === 100){

//Right or D
v3 = new Vector3(-1.0,0.0,0.0);
getAnnots3D(0)[0].context3D.sceen.nodes.getByName("node").transform.translate(v3);
}

if(event.characterCode === 115){

//Down or S
v4 = new Vector3(0.0,-1.0,0.0);
getAnnots3D(0)[0].context3D.sceen.nodes.getByName("node").transform.translate(v4);
}

}


runtime.addEventHandler( myKeyHandler );


////////////////////

I get the error "Vector3 is not Define". New Vector3 syntax is what is used for all the Adobe JavaScript 3D API. I have successfully rotated any 3d object with code...

////////Code///////////

// get index of page containing the Annot3D object (count starts at 0)
pageIndex = this.pageNum;
// index of the Annot3D (count starts at 0)
annotIndex = 0;
// get a reference to the Annot3D script context
c3d = this.getAnnots3D( pageIndex )[ annotIndex ].context3D;
// get a reference to the node in the scene named "Axes"
axes = c3d.scene.nodes.getByName( "Axes" );
// rotate the object about the X-Axis PI/6 radians (30 degrees)
axes.transform.rotateAboutXInPlace( Math.PI / 6 );



/////////////////// 

Rotation works like a charm......How do I get to transform a 3D object to move side to side, up and down in 3d space? Any help is appreciative.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!