Digital Art Zone

 
     
Plz Help, How to bank a camera in Script?
Posted: 03 March 2014 12:16 AM   [ Ignore ]
New Member
Total Posts:  16
Joined  2014-02-28

How to bank camera in script? Please help.

I created a camera in script like this :

//Add new camera
var cam = new DzBasicCamera();
cam.setName( “cameraName” );
Scene.addNode( cam );
var tick = Scene.getTimeStep();

then, I set the X,Y,Z rotation with Rotation Control (XRotControl, YRotControl and ZRotControl)

But I found that operate ZRotControl is not bank!
And when I banking this camera in DAZ View (ctrl + right click + drag), all the X, Y, Z rotation are changing.

Is there a way to do this in script ?

Thanks!

Profile
 
 
Posted: 04 March 2014 03:07 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRank
Total Posts:  325
Joined  2003-10-09

Yes, there is…  quaternions.

var oViewportMgr MainWindow.getViewportMgr();
var 
oViewport oViewportMgr.getActiveViewport();
var 
oViewport3D oViewport.get3DViewport();

var 
oCamera oViewport3D.getCamera();
var 
quatStart oCamera.getLocalRot();
var 
vecAxis = new DzVec30.00.01.0 );
var 
nDegrees 45;
var 
nRadians nDegrees 0.0174532925;
var 
quatBank = new DzQuatvecAxisnRadians );

quatBank quatBank.multiplyquatStart );
oCamera.setLocalRotquatBank ); 

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 04 March 2014 07:05 AM   [ Ignore ]   [ # 2 ]
New Member
Total Posts:  16
Joined  2014-02-28
rbtwhiz - 04 March 2014 03:07 AM

Yes, there is…  quaternions.

var oViewportMgr MainWindow.getViewportMgr();
var 
oViewport oViewportMgr.getActiveViewport();
var 
oViewport3D oViewport.get3DViewport();

var 
oCamera oViewport3D.getCamera();
var 
quatStart oCamera.getLocalRot();
var 
vecAxis = new DzVec30.00.01.0 );
var 
nDegrees 45;
var 
nRadians nDegrees 0.0174532925;
var 
quatBank = new DzQuatvecAxisnRadians );

quatBank quatBank.multiplyquatStart );
oCamera.setLocalRotquatBank ); 

-Rob

Thanks! This helps a lot!

Profile