Body.setPosition(grabber.grabArea.area, grabber.body.body.position);
- console.log('Grab!');
-
for (const grabbable of this.grabbables) {
if (grabbable.entity === grabber.entity) {
const collision = SAT.collides(grabber.grabArea.area, grabbable.body.body);
if (collision.collided) {
grab.constraint = this._createConstraint(grabber.body.body, grabbable.body.body);
- console.log('Grabbing', grab.constraint);
}
}
}
_release(grabber) {
- console.log('Releasing', grabber.grab.constraint);
World.remove(this.engine.world, grabber.grab.constraint);
grabber.grab.currentCooldown = 0;
grabber.grab.constraint = null;
return constraint;
}
-};
+}