PhysicsManager.testPoint 中使用了PhysicsAABBQueryCallback,
PhysicsAABBQueryCallback.prototype.ReportFixture = function (fixture) {
var body = fixture.GetBody();
if (body.GetType() === b2.Body.b2_dynamicBody) {
if (this._isPoint) {
if (fixture.TestPoint(this._point)) {
this._fixtures.push(fixture);
// We are done, terminate the query.
return false;
}
}
else {
this._fixtures.push(fixture);
}
}
// True to continue the query, false to terminate the query.
return true;
};
从上述代码中看到只能检测动态刚体,为什么要这么写,如果我想检测静态刚体怎么办