More Collision Problems

Started by Gatobot14, July 22, 2015, 11:57:39 PM

Previous topic - Next topic

Gatobot14

I been looking all the forum but no anwer cant solve my problem
im using ellipsoid collision, im sure with this mode when a collision occurs it will "slide" to avoid the obstacle
however this just dont work...the model gets stuck in the wall and dont slide at all.
Im using ellipsoid from ExtendedPrimitives with size of (32,50,32)
the ellipsoid for collision is half of ellipsoid (16,25,16)
code for moving forward and check collison

vec=allipsoid.getZAxis();
vec.scalarMul(velz);
vec=ellipsoid.checkForCollisionEllipsoid(vec, body, 4);
ellipsoid.translate(vec);

in the image attached you can see the scene and the ellipsoid
im really clueless , dont know what did i wrong.
i play with some Config value but nothing happend

Gatobot14

well i find that making the ellipsoid smaller(8,8,8) everything works fine, but that doesnt help me
how can i have a bigger ellipsoid and slide when it collides???

EgonOlsen

Shouldn't happen...what's your setting for http://www.jpct.net/doc/com/threed/jpct/Config.html#collideOffset? Have you increased that to maybe 500 or 1000? You also have to make sure that there's no actual collision when you start with the detection. The ellipsoid is a collision avoidance algorithm. It can't resolve existing collisions very well if at all.

Gatobot14

Found it!! the bigger the ellipsoid you have to apply more velocity in my case "velz"=1.0, increasing the value the collision avoidance works fine, that why when i use a smaller ellipsoid nothing bad happen
didnt change the collideOffset just increase velz to 3 and works very well
thanks!!

Gatobot14

This brings me another question, how collision works??
I always think that the ellipsoid is a radius and checks the polygons inside the radius to see if one collides.
how does it works???

EgonOlsen

Quote from: Gatobot14 on July 23, 2015, 05:22:57 PM
Found it!! the bigger the ellipsoid you have to apply more velocity in my case "velz"=1.0, increasing the value the collision avoidance works fine, that why when i use a smaller ellipsoid nothing bad happen
didnt change the collideOffset just increase velz to 3 and works very well
thanks!!
That's a bit strange. It might be caused by inaccuracies in the floating point calculations. If the translation is very small compared to the scale of the ellipsoid and the world, such things might happen but in this case, I wouldn't actually expect them to. Anyway, you might want to try the beta here: http://jpct.de/download/beta/jpct.jar to see if that improves this behaviour. I think that I did some changes to increase accuracy, I'm just not sure if they apply here.

EgonOlsen

Quote from: Gatobot14 on July 23, 2015, 05:41:36 PM
This brings me another question, how collision works??
I always think that the ellipsoid is a radius and checks the polygons inside the radius to see if one collides.
how does it works???
Not quite. The ellipsoid defines the radius in x, y and z directions within which a collision must not happen. So the ellipsoid slides in the direction of the translation vector and if it would intersect with some polygon within this radius, the algorithm corrects the movement so that it avoids this case. But this can't resolve existing collisions, i.e. if there are polygons already in this radius when you start your translation, the algorithm doesn't work too well. It can resolve these cases to a degree if you are lucky, but I wouldn't count on it.