How does the collision detection work

Started by luozi, October 25, 2011, 03:56:22 AM

Previous topic - Next topic

luozi

Hello everyone, recentlly I'm intrested  in the jpct. I find it is very convenient, but when I use the collison detection I met a strange problem.
I create two spheres, one big, one small. When the small one is outside the big one, the collison detection works well, the sphere stoped when collison took place. But when the small one is in the center of the big one the small sphere goes through the big one as if the collisione never. took place.Then I create a plane and both side work well. I'm wondering whether I set something wrong or not. Can anybody give me a help?

AGP

I wonder if it considers the normals. Try flipping them and find out.

AGP

By the way, to flip them you would call Object3D.invert().

EgonOlsen

You can't trigger a collision when colliding with back faces. Like AGP said, in that case you might have to invert the object (which in turn makes it invisible from the outside). If that's an issue, either use separate objects for both sides or, if this isn't needed for rendering, you the inverted one at least for collision detection and set it to invisible afterwards.

luozi

Thank you very much ! I am so glad you reply my question, in our country's forum nobody does.
I think what you mean is that the  sphere has two faces, and the detection is only be detection when another object hit its front face. Am I right? If i'm right  what the difference between the two faces?Buy the way ,I am trying to translate the english jpct to chinese so that my classmates can make full use of the jpct. Thank you again.

EgonOlsen

The difference is, that in the "front" case, the face normal points towards the collision source and in the back face case, it's pointing away. It the exact same thing as back face culling is.