Hi all

I have to Behavior attach to my Universe with
apparently the same wakeUp Condition
a OrbitBehavior and a other behavior (see the code
below)
sometime a Exception is throwed, and I it's difficult
to clearly define the bug context.
is it a Behavior scheduling problem ?a OrbitBehavior
bug? or i' m doing something wrong in my own behavior?

thanks in advance for yours advices
Regards

renaud

Exception occurred during Behavior execution:
javax.media.j3d.BadTransformException: non-congruent
transform above ViewPlatform
        at
javax.media.j3d.TransformGroupRetained.setTransform(TransformGroupRetained.java:138)
        at
javax.media.j3d.TransformGroup.setTransform(TransformGroup.java:111)
        at
prm3d.behavior.OrbitBehavior.integrateTransforms(OrbitBehavior.java:482)
        at
prm3d.behavior.ViewPlatformAWTBehavior.processStimulus(ViewPlatformAWTBehavior.java:249)
        at
javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:172)
        at
javax.media.j3d.J3dThread.run(J3dThread.java:250)

public class PointPicker extends Behavior
{
    private static PickCanvas pickCanvas;
    protected WakeupOnAWTEvent wakeupCriterion;

    protected int x;
    protected int y;
    protected Point3d startPt_ = null;
    protected Point3d endPt_ = null;
    private boolean started_ = false;

    private PointPickerCallBack callBack_;


    public PointPicker( BranchGroup rootBG, Canvas3D
canvas3d, Bounds bounds)
    {

        pickCanvas = new PickCanvas(canvas3d, rootBG);
        pickCanvas.setMode(
PickTool.GEOMETRY_INTERSECT_INFO) ;
        pickCanvas.setTolerance( 2.0f ) ;

        setSchedulingBounds( bounds ) ;
    }

    public void initialize()
    {
        // Wake up when a mouse button is pressed.
        wakeupCriterion = new
WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED);
        wakeupOn(wakeupCriterion);
    }

    public void
setPointPickerCallBack(PointPickerCallBack callBack){
        callBack_ = callBack;
    }
    public PointPickerCallBack
getPointPickerCallBack(PointPickerCallBack callBack){
        return callBack_ ;
    }

    public void processStimulus(Enumeration criteria)
    {
     while (criteria.hasMoreElements())
     {
         WakeupCriterion wakeup =
(WakeupCriterion)criteria.nextElement();
         if (wakeup instanceof WakeupOnAWTEvent)
         {
             AWTEvent[] events =
((WakeupOnAWTEvent)wakeup).getAWTEvent();
             if (events.length > 0 &&
events[events.length-1] instanceof MouseEvent)
             {
                 MouseEvent event =
(MouseEvent)events[events.length-1];
                 updateScene(event);
             }
         }
     }
     wakeupOn(wakeupCriterion);
    }

    public void updateScene(MouseEvent event)
    {
        PrmViewer viewer = PrmViewer.getInstance();

        x = event.getX();
        y = event.getY();

        // Pick the closest node
        pickCanvas.setShapeLocation(x, y);
        Point3d eyePos        =
pickCanvas.getStartPosition();
        PickResult pickResult =
pickCanvas.pickClosest();

        if (pickResult != null)
        {
            PickIntersection pickIntersection =
pickResult.getClosestIntersection(eyePos);
            try
            {//just for getPointCoordinates()
Exception
                Point3d intersectPt =
pickIntersection.getPointCoordinates();
                Point3d intersectPtVW =
pickIntersection.getPointCoordinatesVW();

                if (!started_)
                {
                    started_ = true;

callBack_.PointPickerStart(intersectPt,intersectPtVW);
                }
                else
                {
                    started_ = false;

callBack_.PointPickerEnd(intersectPt,intersectPtVW);
                }
            }
            catch(Exception e){
                callBack_.PointPickerFailed();
            }
        }
        else
        {
            if (event.getClickCount() >= 2)
                callBack_.PointPickerFailed();
        }
    }

    public void setEnable(boolean b){
        started_ = false;
        super.setEnable(b);
    }
}

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Yahoo! Mail : http://fr.mail.yahoo.com

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