Transform3D Problem

i want to know what the function lookAt(point3d,point3d,vector3d)exact as i want to use it but i van not understant it exactly from the documentationthanks
[183 byte] By [rehaba] at [2007-10-2 21:47:18]
# 1
i want to know what the function what it is do lookAt(point3d,point3d,vector3d)exactly as i want to use it but i can not understant it from the documentationthanks
rehaba at 2007-7-14 1:02:59 > top of Java-index,Security,Cryptography...
# 2
lookAt is used for a transform3D object. the first Point3d is for the camera position, the second is for where the camera is looking, the vector is weird, its the up direction, from what Ive seen its just set to 0,1,0.
malachi_1616a at 2007-7-14 1:02:59 > top of Java-index,Security,Cryptography...
# 3
i know this from the documentationbut what it is do i use it to set the location of the viewpoint and make it oriented to these valuesbut how i can make the view point of the scene move according to the value i put always in the lookAt functionplease anyone help me
rehaba at 2007-7-14 1:02:59 > top of Java-index,Security,Cryptography...
# 4

First you have to make the TransformGroup that it is in allow itself to be written to like this...

TransformGroup myTG = new TransformGroup();

myTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

myTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

When ever you want to move the viewpoint around you have to make a new Transform3D object and apply it to the TransformGroup like this...

Transform3D tempT3D = new Transform3D();

myTG.getTransform(tempT3D);

tempT3D.lookAt(new Point3d(x1,y1,z1), new Point3d(x2,y2,z2), new Vector3d(0,1,0));

tempT3D.invert();

myTG.setTransform(tempT3D);

in your main program loop or what ever you are doing, you can change the values of those x y z variables

malachi_1616a at 2007-7-14 1:02:59 > top of Java-index,Security,Cryptography...
# 5

> the vector is weird, its

> the up direction, from what Ive seen its just set to

> 0,1,0.

not necessarily. What if you WANTED you're camera to see the scene as if it was upside down. Then you would set the vector to (0, -1, 0). And if you were walking on walls, you might set the up vector to (-1, 0, 0).

The main point here is that you are literally defining the position of the camera-man. You define WHERE he is and WHERE he is looking, and Java3D will determine WHAT direction he is looking in, based on those two points. Then you define which direction is up to indicate what the logical direction up is from the perspective of the camera man. That's pretty much all there is to it.

If you want to really know how the guts of the transform work, the project has been open sourced. It's easy to get access to the source code. Otherwise, if you still can't figure out exactly how to use it, don't. Write your own "lookAt" method, and you'll know EXACTLY how it works, because you wrote it, and it will give you more control. And in the attempt to write it, you just might understand exactly how it is that the provided method works.

- Adam

guitar_man_Fa at 2007-7-14 1:02:59 > top of Java-index,Security,Cryptography...