jPCT-AE - a 3d engine for Android > Support

Object3D.calcMinDistance() return COLLISION_NONE, but shouldn't happen.

<< < (2/2)

EgonOlsen:
I have only two ideas left than: You aren't doing these calculations in the render thread or your road has culling disbabled and you are trying to calculate the distance to back faces....?

wylng:
I do it in render thread, and I calculate the distance to its face.

Object3D.calcMinDistance() only returns COLLISION_NONE occasionally, it return the right value most the time, and my car go straight on the road, I want to calculate the right Y coordinate and rotateX to place my car on the road.

Does the model affect the calculate?  Is there any restrictions on the model? 

EgonOlsen:
You can be pretty sure that the calcMinDistance-method is flawless. I wouldn't say this if i weren't 110% sure that it is. If all happens in the same thread and the offset/distance settings don't help and you are always testing against the front faces of the road, then it has to have something to do with your road mesh itself. Maybe it has some very tiny gaps in the geometry between the triangles? They don't even have to be visible but thy might the distance calculation to fail. I suggest to take location where it fails and move away from it in very very subtle steps to see how it behaves. If nothing else helps, just ignore the COLLISION_NONE values and use the last correct value instead...

Edit: What irritates me in your code snippet is that your y-axis seems to go up for positive y values. Have you turned the camera 180° around Z or why is that? By default, it's this way: http://www.jpct.net/wiki/index.php/Coordinate_system...but that doesn't match your code.

wylng:
yes, I rotate camera 180.
maya's coordinate system is diffent from jpct

EgonOlsen:
Anyway...i still see tiny gaps in the geometry as the only reason how this can happen. I would just ignore these results and carry on.

Navigation

[0] Message Index

[*] Previous page

Go to full version