What is the problem? Remember that if you want to move anything while it is part of a live scene you need to use a Behaviour.
-ben -----Original Message----- From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED] Behalf Of ADRIANA RAMIREZ Sent: 07 November 2003 14:40 To: [EMAIL PROTECTED] Subject: [JAVA3D] Movement question I've got a frame and it just pretend to be a top view of a rectangle sweeping the frame and leaving a tale made of white points. To achieve it I've been using Threads. The following is the Thread code: public class Movement2D implements Runnable{ public static double tx, ty, a=-0.96, b=-0.29; public static Thread runner; private double d = 0.01; public Movement2D() { runner = new Thread (this); } public void run(){ while(true){ double v1=0.29; if (b <= -v1){ d = 0.01; a += 0.01; } if (b >= v1){ d = -0.01; a += 0.01; } b += d; ty = b; tx = a; Movil2D.TransL1.setTranslation(new Vector3d(tx, ty, 0)); Movil2D.thoraxRotate.setTransform(Movil2D.TransL1); try{ runner.sleep (100); } catch(Throwable t){} } } } The following is the body object code: public class Movil2D { private BranchGroup root; public static TransformGroup thoraxRotate; public static final double width = 0.02, height = 0.06, public static Transform3D TransL1, TransDots; public static TransformGroup Link1TG; public Movil2D() { // Create the root of the branch graph root = new BranchGroup(); /*Make the figure able to rotate*/ thoraxRotate = new TransformGroup (); thoraxRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); thoraxRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); thoraxRotate.setCapability(TransformGroup.ENABLE_PICK_REPORTING); root.addChild(thoraxRotate); //Set Translations TransL1 = new Transform3D(); //Box (link) Link1TG = new TransformGroup(TransL1); Box legLink1 = new Box((float)width,(float)height, (float)width, new BodyAppear().redAppearance()); Link1TG.addChild(legLink1); thoraxRotate.addChild(Link1TG); //Let the java3D perform optimizations on this scene root.compile(); } public BranchGroup getLeg1BG(){ return root; } } Now I want to introduce this code in the thread so the box could leave a tale made of white points Point3f[] positions = new Point3f[1]; positions[0]= new Point3f((float)tx,(float)ty,0f); PointArray point_geom = new PointArray(1, GeometryArray.COORDINATES); point_geom.setCoordinates(0, positions); Shape3D points = new Shape3D(point_geom, new BodyAppear().whiteAppearance()); thoraxRotate.addChild(points); Where the tx and ty variables are going to be refresh by the thread every 100 milisec. I'll apreciate any help. __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree =========================================================================== 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".