> Daryle Singh schrieb:
>
> Hi all,
> I am trying to develop an application which allows the user to cruise
> over an object,
> as if they were in a helicopter.I can move the position of the
> VIEWPLATFORM
> but I cannot set the direction.(So that they are continually looking
> down on the object
> from whatever position they may be in) I know that the TRANSFORM3D
> object has a method
> called LookAT.This apparently is how you set the direction of the
> view.
Transform3D.lookAt(Point3d eye,
Point3d center,
Vector3d up)
is fine. Just remember, to INVERT the transform before
assigning it to the TransformGroup, that holds your ViewPlatform.
Following is a code snipplet I use to have the camera move in
a circle while always looking the the circle center:
public void calcViewpoint()
{ Transform3D viewpoint = new Transform3D();
// 'angle' describes the current position on the circle
// while 'distance' is the circle's radius.
double eyeX = Math.cos(angle) * distance,
eyeZ = Math.sin(angle) * distance;
Point3d eyeLocation = new Point3d(eyeX, 0.0d, eyeZ);
Point3d lookingAt = new Point3d(0.0d, 0.0d, 0.0d);
Vector3d up = new Vector3d(0.0d, 1.0d, 0.0d);
viewpoint.lookAt(eyeLocation, lookingAt, up);
viewpoint.invert();
viewTransformGroup.setTransform(viewpoint);
}
Cheers, Thomas
> Has anybody had any experience using this method? any example code
> would
> be appreciated.
>
>
>
>
> Thanks
> Daryle
===========================================================================
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".