Eric Arnold wrote:
> I just did the same thing... I wanted the ability to walk around using the
> keyboard and look up and down without going through the floor. I still
> haven't been able to get the looking up and down part to work, but the rest
> does if you would like me to send you the code.
> Eric
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
Hi Eric,
What puzzled me a bit when I made my Camera class for moving around and
looking up and down was the calculation of the up-vector - it's not just
(0,1,0) when the Camera isn't horizontal any more.
Here follows that part of my Camera class. You have to invert myTransform if
you use the non-compability mode (default) and then setTransform of the
viewPlatform. Else you can set compability mode to true and call
View.setVpcToEc.
// Calculate up-vector by rotating the camera-direction
// 90 degrees in the plane
// formed by the camera direction and the Y-axis.
// centerToEye is camera direction
Vector3d rotAxis = new Vector3d();
rotAxis.cross(yAxis, centerToEye);
rotAxis.normalize();
AxisAngle4d rotation = new AxisAngle4d( rotAxis.x,
rotAxis.y,
rotAxis.z,
-Math.PI/2 );
Transform3D upTrans = new Transform3D();
upTrans.setRotation( rotation );
Vector3d upVector = new Vector3d( centerToEye );
upTrans.transform( upVector );
myTransform.lookAt( eye, center, upVector);
hope that helps,
Hardy
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".