Hi Katja,

> I am a J3D beginner. I am trying to get a view from above.
> How can I change the view in a simple universe (or a virtual universe) from
> looking along the z axis to looking down the y axis?

This could easily be achieved with
Transfrom3D.lookAt(Point3d eye, Point3d center, Vector3d up):

  Point3d eye    = new Point3d(0, 10, 0);  // 10m above origin
  Point3d center = new Point3d(0, 0, 0);   // origin
  Vector3d up    = new Vector3d(0, 0, -1); // in neg Z direction
  Transform3D t3d = new Transform3D();
  t3d.lookAt(eye, center, up);
  t3d.invert();
  ViewingPlatform viewingPlatform = universe.getViewingPlatform();
  TransformGroup vpTrans = viewingPlatform.getViewPlatformTransform();
  vpTrans.setTransform(t3D);

> How can I get the coordinates when the user clicks on the canvas? I want to
> alow the user to define a path in the world and let the camera move along
> this path.

The main problem here is: when you klick a point in your 2D
projection it defines a _ray_ in your virtual world, not a point.
Somehow you/your user have to specify the missing 3rd coordinate.

If you meant: the user klicks some object of interest in the scene
to look at and the camera then shall move, so that the object is
shown from a certain distance and angle: I have code around to do
that.

The rough outline of it is:
- use picking to find the object of interest and it's coordinates
- calc a good camera position to view the object of interest
- set up a path from the current camera position to the desired
  one. In simple cases a straight line, but might be a TCB spline.
- set up a path from the current lookAt to the desired lookAt point,
  often a straight line, but may also be a TCB spline.
- use a (special) interpolator, that gets both pathes and sets
  camera position and lookAt point in an OrbitBehavior (in my case)
- an Alpha object smoothly acc/decelerates the interpolated values

This outline works with complexer pathes too.

To define arbitrary points in your virtual world have a look at
the J3D sensors.

best regards

Georg
 ___   ___
| + | |__    Georg Rehfeld      Woltmanstr. 12     20097 Hamburg
|_|_\ |___   [EMAIL PROTECTED]           +49 (40) 23 53 27 10

===========================================================================
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".

Reply via email to