checkForCollisionEllipsoid

Started by codertta, December 09, 2015, 07:53:34 AM

Previous topic - Next topic

codertta

I use the elliptical collision detection ineffective, there will be overlapping


help me

EgonOlsen


codertta

Quote from: EgonOlsen on December 09, 2015, 09:11:09 AM
...not sure what you mean...?  ???

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

EgonOlsen

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.

codertta

Quote from: EgonOlsen 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.


how to set ellipsoid size???

obj3d.checkForCollisionEllipsoid(moveRes, ellipsoid, 8);

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

EgonOlsen

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

codertta

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

EgonOlsen

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.

codertta

jpct-ae ,it has gravitational field ?  Ellipse collision detection is very hard。。。。

EgonOlsen

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