Author Topic: checkForCollisionEllipsoid  (Read 2765 times)

Offline codertta

  • byte
  • *
  • Posts: 5
    • View Profile
checkForCollisionEllipsoid
« on: December 09, 2015, 07:53:34 am »
I use the elliptical collision detection ineffective, there will be overlapping


help me

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: checkForCollisionEllipsoid
« Reply #1 on: December 09, 2015, 09:11:09 am »
...not sure what you mean...?  ???

Offline codertta

  • byte
  • *
  • Posts: 5
    • View Profile
Re: checkForCollisionEllipsoid
« Reply #2 on: December 09, 2015, 09:48:38 am »
...not sure what you mean...?  ???

hi,Collision detection is not sensitive,there is  overlap,why? as shown this pic

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: checkForCollisionEllipsoid
« Reply #3 on: December 09, 2015, 10:03:58 am »
The used ellipsoid is only an approximation of the actual shape of the object. You have to choose a reasonable size for it. In your case, you have rather flat objects, which means that your ellipsoid will most likely look something like (x,y,x) where y is much smaller then x. In addition, make sure that you've set the collision modes properly. More information is here: http://www.jpct.net/wiki/index.php?title=Collision_detection

I'm not sure if the ellipsoid collision detection is the best choice for your kind of application and your objects' shapes. Or at least not the only one. Maybe you want to combine it with some ray-polygon checking of some simple distance based logic that you could do on your own.

Offline codertta

  • byte
  • *
  • Posts: 5
    • View Profile
Re: checkForCollisionEllipsoid
« Reply #4 on: December 09, 2015, 11:06:23 am »
The used ellipsoid is only an approximation of the actual shape of the object. You have to choose a reasonable size for it. In your case, you have rather flat objects, which means that your ellipsoid will most likely look something like (x,y,x) where y is much smaller then x. In addition, make sure that you've set the collision modes properly. More information is here: http://www.jpct.net/wiki/index.php?title=Collision_detection

I'm not sure if the ellipsoid collision detection is the best choice for your kind of application and your objects' shapes. Or at least not the only one. Maybe you want to combine it with some ray-polygon checking of some simple distance based logic that you could do on your own.


how to set ellipsoid size???

obj3d.checkForCollisionEllipsoid(moveRes, ellipsoid, 8);

this ellipsoid is poit only ,how to set ellipsoid size???

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: checkForCollisionEllipsoid
« Reply #5 on: December 09, 2015, 11:30:36 am »
No, the ellipsoid isn't a point in space. It's an ellipsoid with the given dimensions. Just like the docs state:

Quote
ellipsoid - the radius of the epplisoid in x,y and z direction

Offline codertta

  • byte
  • *
  • Posts: 5
    • View Profile
Re: checkForCollisionEllipsoid
« Reply #6 on: December 10, 2015, 03:46:22 am »
Do you have this in a similar demo?
 
I change ellipsoid =new SimpleVector(x,y,z), set x=20,y=20,z=20, then the obj on the right do not overlap,but left will overlap ,why?

show this pic

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: checkForCollisionEllipsoid
« Reply #7 on: December 10, 2015, 08:37:18 am »
You have to understand what this ellipsoid actually means. It's an approximation of the object itself, that it more are less accurate, depending on the object. 20,20,20 makes no sense in your case, because while the bed might be 20 wide and deep, it's for sure not 20 high. And if you start with an ellipsoid that's already in a collision, because it overlaps with the rest of the geometry in some way...well, that's not a good idea, because ellipsoid collision detection is a collision AVOIDANCE algorithm. It's not very good in resolving collisions that are already present when you start.
So: Find an ellipsoid size that matches your mesh and doesn't intersect with the rest of the world right from the start. If it helps: There's a createEllipsoid()-method in the ExtendedPrimitives class. Create one with the same size as the one that you are using for your collision, add it to the world and as a child to you collider, so that you can actually see, how your choosen dimensions look in action.

Offline codertta

  • byte
  • *
  • Posts: 5
    • View Profile
Re: checkForCollisionEllipsoid
« Reply #8 on: December 10, 2015, 10:15:34 am »
jpct-ae ,it has gravitational field ?  Ellipse collision detection is very hard。。。。

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: checkForCollisionEllipsoid
« Reply #9 on: December 10, 2015, 01:34:47 pm »
No, it doesn't have this. It's 3D engine, not a game engine. You can implement it by moving the object slightly up, doing an additional collision check with (0,x,0) (move it down again) and translate it by the resulting vector. The example in the wiki actually shows that approach.
Ellipsoid collision detection isn't really that difficult, once you understand what it does (and what it doesn't).