jPCT-AE - a 3d engine for Android > Support
Object3D.calcMinDistance() return COLLISION_NONE, but shouldn't happen.
kiffa:
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:
--- 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);
--- End code ---
log:
--- Code: ---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
--- End code ---
But there shouldn't be the result of COLLISION_NONE(1.0E12). What's the possible reason?
EgonOlsen:
Have you tried to increase this value: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Config.html#collideOffset?
kiffa:
I have tried to increase this value(to a rather large value), but seems useless. :(
EgonOlsen:
Hmm...have you tried to increase the 4 * 30 value to maybe 40*30 (just to see if it helps)?
wylng:
I increased this value to 100 * 30, but that won't help.
Navigation
[0] Message Index
[#] Next page
Go to full version