How to simulate clicking on "Top" of camera cube?
tianxiangxiong
Posts: 21
I'd like to implement in DazScript what happens when you click on "Top" of a camera cube. The camera points down, but maintains other angles. I tried fiddling w/ Euler angle & quaternions but couldn't get it right.
var xAxis = 0; var yAxis = 1; var zAxis = 2; var viewport = MainWindow.getViewportMgr().getActiveViewport(); var camera = viewport.get3DViewport().getCamera(); var angles = camera.getWSRot().getValue(xAxis, yAxis, zAxis); var newQuat = new DzQuat(new DzRotationOrder(xAxis, yAxis, zAxis), new DzVec3(-Math.PI/2, angles.y, 0)); camera.setWSRot(newQuat);
This seems to work when the camera's y-rotation is b/t PI/2 & -PI/2, but not otherwise. I'm sure I'm missing some fundamental concept r.e. quaternions / Euler angles, but I figured I'd ask for help rather than run off & take a semester-long course.
Post edited by tianxiangxiong on