Advertisement

After picking, how is it possible to.......

Started by March 14, 2002 05:40 AM
1 comment, last by jonathan_ingram 22 years, 11 months ago
To actually gradually transform the viewport to the selected object or coordinates? Almost like an animated zoom? If anyone has any ideas or could point me in the right direction, that would be fantastic, since i''m totally stuck with how to do this. Thanks again, Mark.
Regards, Mark.
Ok first question - have you written any ''camera'' code? You will need to prepare a camera before you can approach this problem. Look up some tutorials on camera systems.

Once you''re done, you have several methods of achieving what you want. You can simply interpolate from point a to point b using scalar value k (time). This is probably what you''re after. Or you could move along a bezier curve or a spline of some form.

I dont know if this is what you''re after, but I hope it helps.



-------- E y e .Scream Software --------
----------------------------------------
                                  /-\
    http://www.eyescream.cjb.net | * |
                                  \-/
----------------------------------------
Advertisement
Not really camera code as such, it looks around where the vieport is currently situated.....i''m having trouble finding out how to fully implement the zoom aspect of the camera based on the current angle from the mouse input, any ideas?


if (e.isMetaDown()) {
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));//

float newMoveX = e.getX();
float newMoveY = e.getY();

float angleX = (float)(newMoveX - moveX)*360.0f/(float)getSize().width;//Assign x angle
float angleY = (float)(newMoveY - moveY)*360.0f/(float)getSize().height;//Assign y angle

float mBuf1[] = new float[16];
float mBuf2[] = new float[16];

moveX = newMoveX;//Set
moveY = newMoveY;

if ((angleX != 0.0f) || (angleY != 0.0f)) {
mFun.rotateAroundY(((float)angleX), mBuf1);
mFun.rotateAroundX(((float)angleY), mBuf2);
//Manipulate matrices
mFun.multiplyMatrices(mBuf2,mBuf1, mBuf1);
mFun.multiplyMatrices(rotation, mBuf1, rotation);
}
}

This is based on a rotation matrix class (From GL4java demos).



Regards,
Mark.
Regards, Mark.

This topic is closed to new replies.

Advertisement