Hello,

I'm french, so sorry for bad english.
I have problems when I view an object like a ColorCube and this problem appears when I 
change the distance of the viewingPlatform.
This is very particular :

With the next Code

trans.setTranslation(new Vector3d(0, 0, 50));

I can see easily the color cube (with the mouse and NavigatorBehavior), but when I 
write

trans.setTranslation(new Vector3d(0, 0, 60));

I see the half of the cube : all is like there would be an opaque black object which 
hides a part of the color cube (you see it when you rotate the cube). I don't 
understand why because my code is just an small adaptation of the Basic Sample :
"HelloUnivers", and I have only one Object, there is no special Appearance, no special 
Material ...

Thanks.


import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;

import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;

import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.SimpleUniverse;

public class HelloUniverse extends Applet {

    private SimpleUniverse u = null;

    public BranchGroup createSceneGraph() {
  BranchGroup objRoot = new BranchGroup();
  TransformGroup objTrans = new TransformGroup();
  objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
  objRoot.addChild(objTrans);
  objTrans.addChild(new ColorCube(5));
     objRoot.compile();

  return objRoot;
    }

    public HelloUniverse() {
    }

    public void init() {
  setLayout(new BorderLayout());
         GraphicsConfiguration config =
            SimpleUniverse.getPreferredConfiguration();

  Canvas3D c = new Canvas3D(config);
  add("Center", c);


  OrbitBehavior orbitBehavior = new OrbitBehavior(c, OrbitBehavior.REVERSE_ALL);
  orbitBehavior.setEnable(true);

  BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 5000.0);
  orbitBehavior.setSchedulingBounds(bounds);

  // Create a simple scene and attach it to the virtual universe
  BranchGroup scene = createSceneGraph();
  u = new SimpleUniverse(c);

  u.getViewingPlatform().setViewPlatformBehavior(orbitBehavior);


        // This will move the ViewPlatform back a bit so the
        // objects in the scene can be viewed.
  Transform3D trans = new Transform3D();
  trans.setIdentity();
  trans.setTranslation(new Vector3d(0, 0, 50));

  TransformGroup tg = u.getViewingPlatform().getViewPlatformTransform();
  tg.setTransform(trans);

//        u.getViewingPlatform().setNominalViewingTransform();

  u.addBranchGraph(scene);
    }

    public void destroy() {
  u.removeAllLocales();
    }

    public static void main(String[] args) {
  new MainFrame(new HelloUniverse(), 256, 256);
    }
}

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