Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

292
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda