Some issues about Object3d.checkForCollisionSpherical()

Started by kiffa, April 26, 2013, 03:11:43 PM

Previous topic - Next topic

kiffa

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:





2, The incorrect status, the car may run through the bar(not often):