Bassam, your code does not pick straight "down" from your point. Try
something more like:
Point3d end = new Point3d(point.x ,point.y-5 ,point.z );
Point3d start = new Point3d(point);
- John Wright
Starfire Research
Bassam wrote:
Sorry John it didn't work.It gives the same result (NULL).
As my last choice I will post some of the code. Maybe you can figure out
somethig wrong. Here it is:
///////////////////////////////////////////////////////
//This checks downwards .Parameter "point" is the center of the ball
///////////////////////////////////////////////////////
public void CheckPocketed(Point3f point){
Point3d end = new Point3d(0 ,-5 , 0 );
Point3d start = new Point3d(point);
SceneGraphPath[] result = null;
start.add( end);
PickSegment pickSegment= new PickSegment(start, end);
result = branch.pickAll(pickSegment);
if (result == null) { System.out.println("Ball Falling!"); }
else System.out.println("Ball NOT Falling!");
}
///////////////////////////////////////////////////////
////This is another class that creates the table and the lamp. I set picking
capability bits too.
///////////////////////////////////////////////////////
public class Table extends TransformGroup{
TransformGroup TableTG;
TransformGroup LampTG;
public Table() {
this.setCapability(Node.ENABLE_PICK_REPORTING);
String filename = "3DModel\\pooltable.3DS";
Scene theScene = null;
Scene accessory = null;
///////////////////////
//Creating the Table///
Loader3DS loader = new Loader3DS();
TableTG = new TransformGroup();
try{
theScene = loader.load(filename);
TableTG.addChild(theScene.getSceneGroup());
TableTG.setCapability(Node.ENABLE_PICK_REPORTING);
TableTG.setPickable(true);
}
catch ( IOException e )
{
System.err.println( "** Exception: " + e.getMessage() );
e.printStackTrace( System.err );
}
Transform3D trans3D = new Transform3D();
trans3D.setTranslation(new Vector3f(0.0f,-0.8f,0.0f));
trans3D.setScale(0.7);
TableTG.setTransform(trans3D);
addChild(TableTG);
//Etc. The file creates other elements that are add to transformgroups
other than TableTG.
THANK YOU
BASSAM
----- Original Message -----
From: "John Wright" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 02, 2004 2:59 PM
Subject: Re: [JAVA3D] picking the table
Bassam,
Try using pickAll rather than pickAny. We ended up rewriting all our
terrain following routines because of buggy picking utilities.
- John Wright
Starfire Research
Bassam wrote:
I just want to add more details. The table was done by 3ds Max program
and saved as 3ds format. I ,then, loaded it using John's Wright loader and
add it to a transform group. I set the group's setPickable(true);
The ball is a transform group which has sphere as child .using
PickSegment ,I am picking from the center of the sphere (transformed center)
downwards (I add a point below the center to it), but I am getting null.
Have I missed somthing? What's wrong?
Bassam
I have a ball on a billliard table each is add to different transform
group. The problem is that I am trying to make the ball to pick downwards to
check if it is on the table or pocketed. However ,after picking
scenegraphpath is null, even though the ball is above the table. I am using
Picksegment and calling branchgroup.pickAny().
Can you help me telling me what is wrong?
Bassam
===========================================================================
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".
===========================================================================
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".
===========================================================================
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".