I tried writing a very simple collision detection program exactly on thelines of TickTockCollision.java and CollisionDetector.java The program compiles but when run it immediately detects collision and the behavior does not wake up on exit. The collision is between 2 cylinders. They are set to green color initially and to blue on collision. What happens when the program runs is, for 1sec they are green,and the next instant they turn blue and never turn green again. I could not find the bug. Can someone please help? Here is the code for my program: import java.applet.Applet; import com.sun.j3d.utils.behaviors.picking.*; import java.awt.BorderLayout; import com.sun.j3d.utils.applet.MainFrame; import com.sun.j3d.utils.universe.*; import javax.media.j3d.*; import com.sun.j3d.utils.geometry.*; import javax.vecmath.*; import java.awt.*; class newproject extends Applet{ BranchGroup createscene(Canvas3D c){ BranchGroup objroot = new BranchGroup(); TransformGroup objscale = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setScale(0.4); objscale.setTransform(t3d); Appearance genapp=new Appearance(); ColoringAttributes ca = new ColoringAttributes(); ca.setColor(new Color3f(0.0f,1.0f,0.0f)); genapp.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE); genapp.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ); genapp.setColoringAttributes(ca); TransformGroup cylindertg = new TransformGroup(); cylindertg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); cylindertg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); cylindertg.setCapability(TransformGroup.ENABLE_PICK_REPORTING); Transform3D gent3d = new Transform3D(); gent3d.setTranslation(new Vector3d(-2.5,-0.2,0)); cylindertg.setTransform(gent3d); Cylinder mycylin = new Cylinder(0.2f,1.0f,genapp); mycylin.setCapability(TransformGroup.ENABLE_COLLISION_REPORTING); mycylin.setAppearance(genapp); cylindertg.addChild(mycylin ); TransformGroup cylindertg1 = new TransformGroup(); cylindertg1.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); cylindertg1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); cylindertg1.setCapability(TransformGroup.ENABLE_PICK_REPORTING); gent3d.setTranslation(new Vector3d(1.5,-0.2,0)); cylindertg1.setTransform(gent3d); Cylinder mycylinder = new Cylinder(0.5f,1.0f,genapp); mycylinder.setCapability(TransformGroup.ENABLE_COLLISION_REPORTING); cylindertg1.addChild(mycylinder); myCollisionDetector detectcollide = new myCollisionDetector(mycylinder.getShape(0)); myCollisionDetector detectcollide1 = new myCollisionDetector(mycylin.getShape(0)); BoundingSphere bounds = new BoundingSphere(new Point3d(0,0,0),100.0); detectcollide.setSchedulingBounds(bounds); detectcollide1.setSchedulingBounds(bounds); cylindertg.addChild(detectcollide); cylindertg1.addChild(detectcollide1); objscale.addChild(cylindertg); objscale.addChild(cylindertg1); objroot.addChild(objscale); PickRotateBehavior behavior1 = new PickRotateBehavior(objroot,c,bounds); PickTranslateBehavior behavior2 = new PickTranslateBehavior(objroot,c,bounds); objroot.addChild(behavior1); objroot.addChild(behavior2); objroot.compile(); return objroot ; } public newproject(){ setLayout(new BorderLayout()); Canvas3D c = new Canvas3D(null); add("Center",c); BranchGroup scene = createscene(c); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(scene); } public static void main(String args[]) { new MainFrame(new newproject(),500,350); } } //---------------------------------------------------------------- //the code for this class is exactly same as //CollisionDetector.java in the Examples //-------------------------------------------------------- class myCollisionDetector extends Behavior { private static final Color3f highlightColor = new Color3f(0.0f, 0.0f, 1.0f); private static final ColoringAttributes highlight = new ColoringAttributes(highlightColor, ColoringAttributes.SHADE_GOURAUD); private boolean inCollision = false; private Shape3D shape; private ColoringAttributes shapeColoring; private Appearance shapeAppearance; private WakeupOnCollisionEntry wEnter; private WakeupOnCollisionExit wExit; public myCollisionDetector(Shape3D s) { shape = s; shapeAppearance = shape.getAppearance(); shapeColoring = shapeAppearance.getColoringAttributes(); inCollision = false; } public void initialize() { wEnter = new WakeupOnCollisionEntry(shape); wExit = new WakeupOnCollisionExit(shape); wakeupOn(wEnter); } public void processStimulus(java.util.Enumeration criteria) { inCollision = !inCollision; if (inCollision) { shapeAppearance.setColoringAttributes(highlight); wakeupOn(wExit); } else { shapeAppearance.setColoringAttributes(shapeColoring); wakeupOn(wEnter); } } } ===================================================================== To subscribe/unsubscribe, send mail to [EMAIL PROTECTED] Java 3D Home Page: http://java.sun.com/products/java-media/3D/