These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Pan tool

sbeckers
sbeckers's picture
Registered: Nov 3 2008
Posts: 3

Hello,

I have tried the script "CameraRotate.js" that I have downloaded on the Acrobat website.
When I use this script, I'm unable to use the "pan tool". This script disable this tool.
I have added "runtime.overridePanTool = false " to the script but nothing has change.
1) Is is possible to use this script and to enable the pan tool?

2) is there an example on how to program the "pan tool" in a javascript script ?
I can move following the axes x, y and Z but impossible to reproduce the panoramic move.

Thanks.

S.

sbeckers
sbeckers's picture
Registered: Nov 3 2008
Posts: 3
Here is the link for the CameraRotate.js file :

http://www.acrobatusers.com/tech_corners/3d/3d_resources/javascript/CameraRotate.js

And Here is the kind of script I have added for reproducing the "Pan tool" ... but without success :

var SPEED = 5; //ADDED by SBE

generalKeyboardEventHandler.onEvent = function( event )
{
camera.roll = 0.0;
switch(event.characterCode)
{
case 30: // up Arrow
var x = 0;
var y = - SPEED * Math.sin(pitch);
var z = -SPEED * Math.cos(pitch);

var v3=new Vector3(x,y,z);

targetPosition=targetPosition.add(v3);

camera.up.set(targetPosition.x, targetPosition.y, targetPosition.z + cameraDistance);
camera.targetPosition.set(targetPosition);

break;

case 31: // down Arrow

var x = 0;
var y = SPEED * Math.sin(pitch);
var z = SPEED * Math.cos(pitch);

var v3=new Vector3(x,y,z);

targetPosition=targetPosition.add(v3);
camera.up.set(targetPosition.x, targetPosition.y, targetPosition.z + cameraDistance);
camera.targetPosition.set(targetPosition);

break;

case 28: // left Arrow
var x = -SPEED * Math.cos(yaw);
var y = -SPEED * Math.cos(yaw) * Math.cos(pitch);
var z = -SPEED * Math.sin(pitch) * Math.cos(yaw);

var v3=new Vector3(x,y,z);

targetPosition=targetPosition.add(v3);
camera.up.set(targetPosition.x, targetPosition.y, targetPosition.z + cameraDistance);
camera.targetPosition.set(targetPosition);

break;

case 29: // right Arrow
var x = SPEED * Math.cos(yaw);
var y = SPEED * Math.cos(yaw) * Math.cos(pitch);
var z = SPEED * Math.sin(pitch) * Math.cos(yaw);



var v3=new Vector3(x,y,z);

targetPosition=targetPosition.add(v3);
camera.up.set(targetPosition.x, targetPosition.y, targetPosition.z + cameraDistance);
camera.targetPosition.set(targetPosition);

break;

}

}//-------------------------------------------------------

runtime.addEventHandler( generalKeyboardEventHandler );