maybe when you move the object , you dont multiply the matrix of the
Transform Group , and it change the position, or maybe im wrong xD
i give a example:
ColorCube cube=new ColorCube();
BranchGroup modelObj=new BranchGroup();
TransformGroup trasnformModel=new TransformGroup();
TransformGroup rotateModel=new TrasnformGroup();
rotateModel.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
rotateModel.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
rotateModel.addChild(cube);
transformModel.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
transformModel.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
transformModel.addChild(rotateModel);
modelObj.addChild(transformModel);
//Transform to Move the object and rotate
Transform3D t3d= new Transform3D();
Transform3D t3dRot= new Transform3D();
Transform3D t3dMov= new Transform3D();
//Movement
t3dMov.setTranslation(new Vector3d(0.0f,0.0f,1.0f));
t3d.mul(t3dMov);
transformModel.setTransform(t3d);
//Rotate all the object
t3dRot.rotX(x);
t3d.mul(t3dRot);
transformModel.setTransform(t3d);
//New Transform to Rotate the object but doesnt change his egde
Transform3D t3d2= new Transform3D();
Transform3D t3dRot2= new Transform3D();
//Rotate the object but in the same edgde
t3dRot2.rotZ(z);
t3d2.mul(t3dRot2);
rotateModel.setTransform(t3d2);
i hope it's help you! :)
pd: sorry my english
On Mar 10, 9:40 pm, Mark Hood <inva...@[EMAIL PROTECTED]
> wrote:
> Weird... you replyed to a post from over a year ago.
>
> Anyway, abandoning Java 3D is an option and makes sense over the long
> term, but it might not be the best option short term if one has a lot
> of code invested in it, especially when a fix for a specific problem
> is available and well-known:
>
> Java 3D has a 1-frame latency between the view parameters currently in
> use by the renderer and the scene graph view platform position that
> the application sets. So if you take the view parameters from
> something like Canvas3D's ImagePlateToVworld and align some geometry
> in the scene graph to it, it will end up being 1 frame behind the
> actual view by the time the scene graph is actually updated by the
> system.
>
> The ViewInfo utility class (somewhere in com.sun.j3d.utils.universe)
> will give you view info that is up-to-date with respect to the current
> state of the scene graph.
>
> -- Mark


|