> Date:         Mon, 18 Feb 2002 12:21:55 +0100
> From: Timo Ropinski <[EMAIL PROTECTED]>
>
> hi everyone, if got this code-snip defining a viewbranch. but the error is
> that the ViewPlatform is not attached to the BranchGroup. everytime i try to
> attach it, i get an MultipleParentException. does anyone know how to attach
> it and where it is attached right now

>From your code snippet it doesn't look like you have attached the ViewPlatform
to anything.  Since your ViewBranch class extends BranchGroup you should be
able to simply call addChild() with your ViewPlatform instance and then add
your ViewBranch instance to a Locale (but you'll probably want to add a
TransformGroup above the ViewPlatform so you can manipulate the view position
and orientation).

For an example of something very similiar to what you're doing take a look at
the source code for com.sun.j3d.utils.universe.ViewingPlatform.

> public class ViewBranch extends BranchGroup {
>   :
>   :
>   public ViewBranch(Canvas3D canvas) {
>     platform = new ViewPlatform();
>     phyBody = new PhysicalBody();
>     phyEnv = new PhysicalEnvironment();
>
>     view = new View();
>     view.setPhysicalBody(phyBody);
>     view.setPhysicalEnvironment(phyEnv);
>     view.setBackClipDistance(BACK_CLIP_DISTANCE);
>     view.setFrontClipDistance(FRONT_CLIP_DISTANCE);
>     view.attachViewPlatform(platform);
>     view.addCanvas3D(canvas);
>     :
>     :
>   }
> }

-- Mark Hood

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