www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: kiffa on April 26, 2013, 03:11:43 pm
-
My racing game, Codes:
//onDrawFrame, move car.
mStep = calcStepBySpeed();
SimpleVector fixedStep = null;
if (!(fixedStep = mModel.checkForCollisionSpherical(mStep, r)).equals(mStep)) {
fixedStep.y = mStep.y;
mStep = fixedStep;
}
mModel.translate(mStep);
Problem: Sometimes, the car can run through the bar(collider). See the pic below, the white ball is the boundingSphere of the car.
1, The correct collision status:
(http://p13.freep.cn/p.aspx?u=v20_p13_photo_1304262112558998_0.jpg)
2, The incorrect status, the car may run through the bar(not often):
(http://p13.freep.cn/p.aspx?u=v20_p13_photo_1304262113407022_0.jpg)