In my car-racing game, I need calc the distance between "rear\front" and road. But the result seems incorrect.
The car and road:
-------
| |
--------------------
| |
--------------------
rear front
---------------------------------------- road
code: mCar.Translate(0, 50, 0); // move up
SimpleVector d = new SimpleVector(0, -1, 0);
float frontHeight = mRoad.calcMinDistance(front, d, 4 * 30);
float rearHeight = mRoad.calcMinDistance(rear, d, 4 * 30);
WLog.d("front: " + front);
WLog.d("rear: " + rear);
WLog.d("frontHeight: " + frontHeight);
WLog.d("rearHeight: " + rearHeight);
log:
09-15 16:30:56.680: D/Woo3d(4707): frontHeight: 50.03162
09-15 16:30:56.680: D/Woo3d(4707): rearHeight: 1.0E12
09-15 16:30:56.690: D/Woo3d(4707): front: (-2172.8433,50.031296,-1480.5132)
09-15 16:30:56.690: D/Woo3d(4707): rear: (-2172.3599,50.031296,-1543.8423)
09-15 16:30:56.690: D/Woo3d(4707): frontHeight: 50.03162
09-15 16:30:56.690: D/Woo3d(4707): rearHeight: 1.0E12
09-15 16:30:56.710: D/Woo3d(4707): front: (-2172.8623,50.031296,-1477.4586)
09-15 16:30:56.710: D/Woo3d(4707): rear: (-2172.379,50.031296,-1540.7877)
09-15 16:30:56.710: D/Woo3d(4707): frontHeight: 50.03162
09-15 16:30:56.710: D/Woo3d(4707): rearHeight: 50.03162
But there shouldn't be the result of COLLISION_NONE(1.0E12). What's the possible reason?