Author Topic: Some issues about Object3d.checkForCollisionSpherical()  (Read 567 times)

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Some issues about Object3d.checkForCollisionSpherical()
« on: April 26, 2013, 03:11:43 pm »
My racing game, Codes:
 
Code: [Select]
    //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):




« Last Edit: April 26, 2013, 03:14:06 pm by kiffa »