The simplest thing you can do is to create the RotationInterpolator and Alpha right from the begining. Make sure your Alpha is paused. Then when somebody wants to "spin", you just set the new axisOfTransform in the existing RotationInterpolator and the values for the Alpha object and then start / resume the Alpha object. Don't forget to set the necessary capabilities and to reset the startTime for the Alpha object each time you start it.
Cheers, Florin -----Urspr?ngliche Nachricht----- Von: Sandegren, Eric S. [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 20. Februar 2003 04:54 An: [EMAIL PROTECTED] Betreff: [JAVA3D] RotationInterpolator on live graph I have a live scene graph and I want to give my user the ability to change the axis (and alpha information) about a RotationInterpolator. They select the rotation axis, number of revolutions, and time delay for alpha and then hit a button to start the spin. After it has completed the number of revs, I want to let them choose a different axis and do it again. I have found a bunch of code about RotationInterpolators, but they all seem to deal with planning a spin prior to making the graph live. I need to modify the Interpolation after the graph is live.... I have these nodes: TransformGroup theModel -- my model to spin BranchGroup modelGroup -- used to attach and detach models when they open a different model file. RotationInterpolator rotate -- the rotation BranchGroup removableRot -- I found a code snippet that showed how to add and detach behaviors by wrapping in a branchgroup. I tried this but to no avail =( Code for creating theModel TG: { modelGroup.detach(); modelGroup = new BranchGroup(); modelGroup.setCapability(BranchGroup.ALLOW_DETACH); modelGroup.setCapability(BranchGroup.ALLOW_CHILDREN_READ); modelGroup.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); Inspector3DS loader = new Inspector3DS(sFilename); loader.setLogging(true); // turns on logging to a disk file "log3ds.txt" loader.setDetail(7); // sets the level of detail to be logged loader.parseIt(); theModel = loader.getModel(); theModel.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); theModel.setCapability(TransformGroup.ALLOW_CHILDREN_READ); theModel.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE); theModel.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND); modelGroup.addChild(theModel); rotate = new RotationInterpolator(new Alpha(0,0), theModel); BoundingSphere bounds = new BoundingSphere(); rotate.setBounds(bounds); removableRot = new BranchGroup(); removableRot.addChild(rotate); removableRot.setCapability(BranchGroup.ALLOW_DETACH); theModel.addChild(removableRot); scene.addChild(modelGroup); } Code for when they click "Spin": { Transform3D rotT3D = new Transform3D(); if (xRBSpin.isSelected()) { // X was selected rotT3D.rotX(Math.PI*2/180); System.out.println("rotating on x"); } else if (yRBSpin.isSelected()) { // Y was selected rotT3D.rotY(Math.PI*2/180); System.out.println("rotating on y"); } else if (zRBSpin.isSelected()) { // Z was selected rotT3D.rotZ(Math.PI*2/180); System.out.println("rotating on z"); } System.out.println("revs: " + revs + " delay: " + delay); Alpha rotationAlpha = new Alpha(revs, delay); rotate = new RotationInterpolator(rotationAlpha, theModel); rotate.setTransformAxis(rotT3D); BoundingSphere bounds = new BoundingSphere(); rotate.setBounds(bounds); removableRot.detach(); removableRot.addChild(rotate); theModel.addChild(removableRot); } Any ideas? Thank you Eric Sandegren =========================================================================== 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".