Author Topic: More Collision Problems  (Read 3406 times)

Offline Gatobot14

  • int
  • **
  • Posts: 64
    • View Profile
More Collision Problems
« on: July 22, 2015, 11:57:39 pm »
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
Code: [Select]
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

Offline Gatobot14

  • int
  • **
  • Posts: 64
    • View Profile
Re: More Collision Problems
« Reply #1 on: July 23, 2015, 02:09:34 am »
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???

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: More Collision Problems
« Reply #2 on: July 23, 2015, 07:30:43 am »
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.

Offline Gatobot14

  • int
  • **
  • Posts: 64
    • View Profile
Re: More Collision Problems
« Reply #3 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!!

Offline Gatobot14

  • int
  • **
  • Posts: 64
    • View Profile
Re: More Collision Problems
« Reply #4 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???

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: More Collision Problems
« Reply #5 on: July 23, 2015, 09:05:09 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: More Collision Problems
« Reply #6 on: July 23, 2015, 09:08:47 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.