1
Support / Re: Behavior of Ellipsoid collision detection
« on: February 26, 2013, 11:05:49 pm »
Yeah, it was more just something I found while playing around with the different algorithms. Thanks for the explanation.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
SimpleVector v = new SimpleVector(1.0f, 2.0f, 3.0f);
SimpleVector normal = new SimpleVector(0, -1.0f, 0);
SimpleVector vr = v.reflect(normal);
Log.i("reflect", "v="+v+" normal="+normal+" vr="+vr);
Object3D source = Primitives.getSphere(1f);
source.setCollisionMode(Object3D.COLLISION_CHECK_SELF);
source.translate(0, -2.5f, 0);
graphicsWorld.addObject(source);
Object3D target = Primitives.getSphere(1f);
target.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
target.addCollisionListener(new CollisionHandlerTest());
graphicsWorld.addObject(target);
SimpleVector unitDir = new SimpleVector(0, 1, 0);
Log.i("Collision", "Object collisions");
source.checkForCollision(unitDir, 2);
SimpleVector adj = source.checkForCollisionEllipsoid(unitDir, new SimpleVector(1, 1, 1), 5);
Log.i("Collision", "Ellipsoid adjusted: "+adj);
adj = source.checkForCollisionSpherical(unitDir, 1);
Log.i("Collision", "Spherical adjusted: "+adj);