Hello folks,

I'm trying to get an object that's been clicked by the user.
My problem is that it always return null.

here is my code (extract from my Behavior class):
...
SceneGraphPath[] stuffPicked = root.pickAll(getPickRay(x,y));
System.out.println(stuffPicked);
...
}

private PickRay getPickRay(int xpos, int ypos) {
Point3d mousePos = new Point3d();
Vector3d mouseVec=new Vector3d();
Point3d eyePos = new Point3d();
PickRay pickRay=new PickRay();

universe.getCanvas().getCenterEyeInImagePlate(eyePos);
universe.getCanvas().getPixelLocationInImagePlate(xpos,ypos,mousePos);
mouseVec.sub(mousePos, eyePos);
mouseVec.normalize();

pickRay.set(eyePos, mouseVec);
System.out.println(eyePos+","+ mouseVec); // Strange the eyePos keep 
changing on each run

return pickRay;
}//End getPickRay

What am I doing wrong?

Regards,

Chris.
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to