Hi all!
I have implemented a mouseReleased method where I want to pick a cube in the
scene. The only problem is that the cube is picked no matter where I click
on the screen. What have I done wrong?
Thanks for helping me!
Todda
Point3d _point3d = new Point3d();
Vector3d _vector3d = new Vector3d(0,0,-1);
public void mousePressed(MouseEvent e){
if(e.isControlDown()==true)
_ray = new PickRay(_point3d, _vector3d);
}
public void mouseReleased(MouseEvent e){
if(e.isControlDown()==true) {
int x = e.getX();
int y = e.getY();
_canvas.getPixelLocationInImagePlate(x, y, _point3d);
_ray.set(_point3d, _vector3d);
try{
_results = _branchgroup.pickAny(_ray);
Node pickedObject = _results.getObject();
System.out.println("object picked :" + pickedObject );
}
catch(Exception ex){
System.out.println("No objects picked");
}
}
}
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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".