mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
@@ -1,23 +1,31 @@
|
||||
|
||||
function PhysicsAABBQueryCallback () {
|
||||
this._point = new b2.Vec2();
|
||||
this._isPoint = false;
|
||||
this._fixtures = [];
|
||||
}
|
||||
|
||||
PhysicsAABBQueryCallback.prototype.init = function (point) {
|
||||
this._point.x = point.x;
|
||||
this._point.y = point.y;
|
||||
if (point) {
|
||||
this._isPoint = true;
|
||||
this._point.x = point.x;
|
||||
this._point.y = point.y;
|
||||
}
|
||||
else {
|
||||
this._isPoint = false;
|
||||
}
|
||||
|
||||
this._fixtures.length = 0;
|
||||
};
|
||||
|
||||
PhysicsAABBQueryCallback.prototype.ReportFixture = function (fixture) {
|
||||
var body = fixture.GetBody();
|
||||
if (body.GetType() === b2.Body.b2_dynamicBody) {
|
||||
if (this._point) {
|
||||
if (this._isPoint) {
|
||||
if (fixture.TestPoint(this._point)) {
|
||||
this._fixtures.push(fixture);
|
||||
// We are done, terminate the query.
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user