We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › java 3d boundingbox intersection (collision)
Page Index Toggle Pages: 1
java 3d boundingbox intersection (collision) (Read 1540 times)
java 3d boundingbox intersection (collision)
Jul 19th, 2009, 10:00am
 
hello,
I try to just use Boundungbox intersect between two boxes without using anything else from j3d in order to have a "poor's man collision detection".

     public BoundingBox makeBoundingBox3D(Point3d p, float x, float y, float z) {            
           return new BoundingBox(      new Point3d((p.x+x/2),(p.y+y/2),(p.z+z/2)),
                                               new Point3d((p.x-x/2),(p.y-y/2),(p.z-z/2)) );
     }
     
     public boolean notFoobar( Point3d p) {
           BoundingBox foo = makeBoundingBox3D(p, 1f, 1f, 1f);
           
           for (int i = 0; i < constrains.size(); i++) {
                 if ( constrains.get(i).intersect(foo) ) {
                       println("skata");
                       return false;
                 }
           }
           return true;
     }

====

But I can get any false to return.

Do we need to initialize some j3d world or something? (I dont know anything about j3d)

thnx
zeta
Re: java 3d boundingbox intersection (collision)
Reply #1 - Jul 20th, 2009, 2:55pm
 
Re: java 3d boundingbox intersection (collision)
Reply #2 - Jul 21st, 2009, 8:42am
 
maybe something in 3d and in java? I have used the internal java functions but I think need some kind of '3d world init' in order to function.

zeta
Page Index Toggle Pages: 1