Hello
Your questions reveal interesting features we should have in MASON. They
go along well with Professor Luke's idea that we should be able to have
the camera follow a specific 3D object as it moves through the scene.
In the meantime, I think that you should change the transformation
(Transform3D) of universe.getViewingPlatform().getViewPlatformTransform().
So far we did not need to move the camera cause all the fields (Grids,
or Continuous) were bounded. We'd set the scene and call
universe.getViewingPlatform().setNominalViewingTransform(), which "sets
the nominal viewing distance in the ViewPlatform transform based on the
current field of view. [...] The ViewPlatform is moved back along Z so
that objects at the origin spanning the normalized X range of -1.0 to
+1.0 can be fully viewed across the width of the window."
To set the camera's field of view, we call
canvas.getView().setFieldOfView() in Display3D.setScale().
Instead of playing with the camera you can play with the model.
All your stuff (java3D stuff created by your portrayal3Ds) hang from
Display3D.globalModelTransformGroup. This group (i.e everything inside)
can be transformed (scaled, translated, rotated) using
Display3D.transform, or the more user friendly translate, scale, rotateX,
rotateY, rotateZ.
If your scene grew bigger than before, scale everything back down.
Did your 3d objects run more to the right than to the left? You can either
move the camera to the right or move the entire world to the left.
Hope this helps,
Gabriel Balan
On Wed, 19 Jul 2006, MASON-INTEREST-L automatic digest system wrote:
> There is 1 message totalling 41 lines in this issue.
>
> Topics of the day:
>
> 1. Display3D viewing and camera operations
>
> ----------------------------------------------------------------------
>
> Date: Tue, 18 Jul 2006 14:24:06 +0100
> From: Michael Lees <[log in to unmask]>
> Subject: Display3D viewing and camera operations
>
> Hello all,
>
> I have a couple of questions - hopefully fairly straightforward.
>
> Both relate to changing the default view of the camera when using Display3D.
>
> Q1. I've figured out how to change the scale, using the Display3D.scale
> method. However, I haven't managed to change the view point. How do I do
> this? So for example how do I get the camera centred on (10,10,10)
> looking down/up the z axis (or whatever is default).
>
> Q2. I'm actually trying to centre the view at the middle of a cube (the
> view can be along any axis as long as it points to the centre of the
> cube). I would have thought it'd be possible to write a centre method
> which automatically moves the camera (and perhaps alters scale) so that
> it points at the centre of the scene (and possibly scales to fit in the
> whole scene).
> You would just need to know the smallest and largest x,y,z of all fields
> in the model.
>
> Thanks for the help
>
>
|