Show Posts

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.

Messages - mesh

Pages: [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.

Bugs / Reflected vector is inverted
« on: February 26, 2013, 09:51:57 pm »
I think SimpleVector.reflect returns a vector which is -1* the correct reflection. Example:
Code: [Select]
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);

Result is: v=(1.0,2.0,3.0) normal=(0.0,-1.0,0.0) vr=(-1.0,2.0,-3.0)

I expect the reflection to be (1, -2, 3). Same result regardless of whether the normal vector points toward or away from the input vector.

Support / Behavior of Ellipsoid collision detection
« on: February 26, 2013, 09:41:19 pm »
I'm getting started with JPCT and I noticed a strange result with the ellipsoid collision detection. Here is my test:
Code: [Select]
Object3D source = Primitives.getSphere(1f);
source.translate(0, -2.5f, 0);

Object3D target = Primitives.getSphere(1f);
target.addCollisionListener(new CollisionHandlerTest());

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);

I move the source sphere up by 2.5 units so that it's 0.5 away from the top of the target sphere. Then I try what I believe to be equivalent collision tests, using a radius of 1 for both spherical and ellipsoid methods. The result is:

02-26 21:27:57.305: I/Collision(31851): Object collisions
02-26 21:27:57.315: I/Collision(31851): FirstContact:(0.0,-1.0,0.0) Algo:Ray
02-26 21:27:57.365: I/Collision(31851): FirstContact:(0.0,-2.1,0.0) Algo:Ellipsoid
02-26 21:27:57.365: I/Collision(31851): Ellipsoid adjusted: (0.0,0.4000001,0.0)
02-26 21:27:57.385: I/Collision(31851): FirstContact:(0.037469428,-1.999996,0.005934572) Algo:Sphere
02-26 21:27:57.385: I/Collision(31851): Spherical adjusted: (0.037469428,0.50000405,0.005934572)

Ray and Sphere seem right, but ellipsoid appears to detect 0.1 units before it should. Changing the recursion depth 1-5 doesn't have an effect. Thoughts?

Pages: [1]