strange ray casting behaviour

Started by raft, May 05, 2007, 04:18:59 PM

Previous topic - Next topic

raft

hello,

i'm experiencing some problems with ray casting:

       
        Config.collideSectorOffset = Object3D.COLLISION_NONE;
        Config.collideOffset = Float.MAX_VALUE;

        int objectId = world.checkCollision(topCenter, DOWN, Float.MAX_VALUE);
        if (objectId == Object3D.NO_OBJECT) {
            return NO_GROUND;
        }
        Object3D object = world.getObject(objectId);
        float distance = object.calcMinDistance(topCenter, DOWN, Float.MAX_VALUE);
        assert (distance != Object3D.COLLISION_NONE);


surprisingly the assertion above fails  ??? is it a configuration issue or ? i suspected a rounding error so i tried second part Object3D.calcMinDistance from a little bit higher location but the result is the same  :-\

DOWN is a normalized vector pointing downwards: new SimpleVector(0, 1, 0);

any ideas ?
thx

r a f t

EgonOlsen

Have you tried it with a breakIfLarger-value below MAX_VALUE? The value will be added to some other values so this may lead to some overflow? Maybe it works with the other method, i.e.

float distance = object.calcMinDistance(topCenter, DOWN);

raft

unfortunately doesnt work either  :-\
if you wish i may send a test case

raft

i've visually inspected the situaution. indeed in this case object.calcMinDistance(topCenter, DOWN) returns a true value, problem is world.checkCollision(topCenter, DOWN, Float.MAX_VALUE) should return Object3D.NO_OBJECT but it doesnt

in the top view below, the small cube is placed at where the ray is casted

EgonOlsen

Have you tried World.checkCollision with another value than MAX_VALUE? I don't think that MAX_VALUE is a good idea in general. If that doesn't help, a test case would be great.

raft

yeap, it did help, thx  :) so it's kind of summation overflow..
what about Config.collideOffset, is it also unsafe to set it to MAX_VALUE ?

EgonOlsen

I'm not sure, but i wouldn't set anything to MAX_VALUE.

raft