My project is to build a fully rotatable 3D star map in Java. I currently
have about 3000 sphere transforms in a contentBranchGroup which is running
incredibly slowly (but that's for another mail). My problem is that I
should be able to select a star and move the camera to point directly at
it. However, because the stars are rotatable, the star positions (x,
y, z coordinates) change all the time. How can I keep track of their
coordinates?

I can think of three possible ways of doing it.

1. Clone the original contentBranch group which holds the original star
positions. Then when a star is selected, remove the old contentBranch and
insert a copy of the original one. Then perform a transform to get to the
required star because I know its exact position. I've tried this but when
it tries to clone the tree I get an IndexOutOfRange exception where index
= -1. 

2. Keep track of the transforms made to the stars when the view is being
rotated and try and reverse them somehow. This will get me my
original view and I can move to the desired star because I know
exactly where it is. Similar to the first idea just a different way 
of getting the original view. Because I have such a lack
of 3D graphics knowledge I don't know how to do it or if it's even at all 
possible.

3. Get the star's Vector coordinates. If a star is selected I know what
child it is of the contentBranch tree because of the way it was added to
the group. So how do I get the x, y, z coordinates of the node?

I'm sorry if this is totally unintelligible or if I'm being incredibly
stupid but I really need help. If I haven't explained myself properly then
mail back and I'll go into a bit more detail but I really would appreciate
any help anyone could give (my project's to be finished within the next
four days).

Cheers,
Dave.

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to