Hello,
i've a problem with the collision detection system. I'm trying to
collidate a IndexedTriangleArray(ita) with another Shape.
Sometimes it works fine, sometimes occurs that only the half part of the
ita(its a rectangular) is been detected. I tryied and retried but i havnt
found the problem.
I've attached a sampleCode, it's only a nonsense but i think it shows the
problem well.(my problem is much much bigger)
thanks for any helps
ColorCube cc= new ColorCube(0.2);
QuadArray geom=(QuadArray) cc.getGeometry();
config= SimpleUniverse.getPreferredConfiguration();
canvas= new Canvas3D(config);
universe= new SimpleUniverse(canvas);
this.getContentPane().add(canvas,"Center");
//ColorCube 1
QuadArray quad= new QuadArray(24,QuadArray.COORDINATES);
for (int i=0; i<geom.getVertexCount();i++) {
double[] d= new double[3];
geom.getCoordinate(i,d);
quad.setCoordinate(i,d);
}
IndexedTriangleArray ita= new IndexedTriangleArray
(4,IndexedTriangleArray.COORDINATES,12);
ita.setCapability(ita.ALLOW_INTERSECT);
ita.setCoordinate(0,new Point3d(0.0,0.0,0));
ita.setCoordinate(1,new Point3d(0.0,0.4,0.0));
ita.setCoordinate(2,new Point3d(0.4,0.4,0));
ita.setCoordinate(3,new Point3d(0.4,0.0,0.0));
ita.setCoordinateIndex(0,1);
ita.setCoordinateIndex(1,2);
ita.setCoordinateIndex(2,0);
ita.setCoordinateIndex(3,0);
ita.setCoordinateIndex(4,2);
ita.setCoordinateIndex(5,3);
ita.setCoordinateIndex(6,2);
ita.setCoordinateIndex(7,1);
ita.setCoordinateIndex(8,0);
ita.setCoordinateIndex(9,0);
ita.setCoordinateIndex(10,3);
ita.setCoordinateIndex(11,2);
/*mit ColorCube funkts wunderbar... da muss irgendwas bez�glich keine
ahnung sein.....
jetzt funkt nichts mehr
*/
TransformGroup tg= new TransformGroup();
tg.setCapability(tg.ENABLE_PICK_REPORTING);
tg.setCapability(tg.ENABLE_COLLISION_REPORTING);
tg.setCapability(tg.ALLOW_TRANSFORM_READ);
tg.setCapability(tg.ALLOW_TRANSFORM_WRITE);
Shape3D s3d= new Shape3D(ita);
s3d.setCapability(s3d.ENABLE_COLLISION_REPORTING);
tg.addChild(s3d);
mainBranchGroup.addChild(tg);
//ColorCube 2
tg= new TransformGroup();
Transform3D t3d= new Transform3D();
tg.setTransform(t3d);
tg.setCapability(tg.ENABLE_PICK_REPORTING);
tg.setCapability(tg.ENABLE_COLLISION_REPORTING);
tg.setCapability(tg.ALLOW_TRANSFORM_READ);
tg.setCapability(tg.ALLOW_TRANSFORM_WRITE);
QuadArray quad2= new QuadArray(24,QuadArray.COORDINATES);
for (int i=0; i<geom.getVertexCount();i++) {
double[] d= new double[3];
geom.getCoordinate(i,d);
quad2.setCoordinate(i,d);
}
Shape3D s= new Shape3D(quad2);
s.setCapability(s.ENABLE_COLLISION_REPORTING);
s.setCapability(s.ALLOW_GEOMETRY_READ);
s.setBoundsAutoCompute(true);
tg.addChild(s);
mainBranchGroup.addChild(tg);
MyCollisionBehavior mcb= new MyCollisionBehavior(tg);
mainBranchGroup.addChild(mcb);
===========================================================================
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".