Ok sure :)  It's hard to keep banging your head against a wall on the same
problem!

Ok... the method node.getLocalToVworld(t3d3) will ONLY work if your node is
in a live scene.  If it is part of the live scene, but there are no
translations done between the root of the scene and the node, then it will
return (0,0,0) as the location.  If the location of the node is (0,0,0) BUT
the shapes are appearing somewhere other than the origin then the vertices
of the geometries within the shape are placing the object somewhere other
than the origin.  Use the getBounds() method to find out a rough idea of the
range of vertice that are inside your shape.

So that answers your question "I just want to get the coords of the objects
I have loaded from a .obj file".

David Yazel
http://www.cosm-game.com


----- Original Message -----
From: thorsten topol <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 19, 2001 6:01 AM
Subject: Re: [JAVA3D] obj coordinates


Hi,
Thank you very much for your help (again) but there is
something I really don't understand.

I just want to get the coords of the objects I have
loaded from a .obj file
These objects are addchilded() to the scene, then to
the branch group.

>scene = ObjectFile.load(filename);
...
>branchgroup.addChild(scene.getSceneGroup());

Then I recover my objects with

>Hashtable objs= new Hashtable();
>objs= scene.getNamedObjects();

and transform them with

>Set keys = objs.keySet();
>Iterator ite = keys.iterator();
>while (ite.hasNext()){
>     Object obj3d = ite.next();
>     Shape3D node = (Shape3D) objs.get(obj3d);
>
node.setCapability(javax.media.j3d.Node.ALLOW_LOCAL_TO_VWORLD_READ);

>     file://relooking
>     if (node != null) {
>         node.setAppearance(app0);
>     }

this work fine so my objects seems to be in a live
scene graph (they are rendered!).

The problem is I can't have these coord with
>      Transform3D t3d3 = new Transform3D();
>       try{
>            node.getLocalToVworld(t3d3);
>        }
>         catch(RestrictedAccessException e){}
>}

(it returns
"javax.media.j3d.RestrictedAccessException: Node:
local to vworld transform is undefined for a node that
is not part of a live scene graph")


I tried to get the coords once the branchgroup has
been added to the unverse. I have then (0.0,0.0,0.0)
coords for all my objects (egad!)

Can you help me?

Thorsten.




> > Here, you new a Shape3D, but you haven't
> > addChilded() it to
> > anything attached to the root yet.  There's no
> > getLocalToVworld() defined.
> >
> > Are you trying to setAppearance() based on the
> > Shape3D's global
> > position?  If so, you have to wait until after
> > you've attached
> > the Shape3D to the live scene graph (after a
> > setCapability(ALLOW_APPEARANCE_WRITE)).
> >
> > . . .
> >
> > Hth,
> > Fred Klingener
> >
> >


___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Yahoo! Courrier : http://courrier.yahoo.fr

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

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