mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Remove commented out grab sensors and area sensors
- Clean up commented fixture definitions that were temporarily disabled during debugging
This commit is contained in:
parent
49f4591d3a
commit
799601f24d
1 changed files with 38 additions and 38 deletions
|
|
@ -110,45 +110,45 @@ function (Parent, Exception, planck, Settings, CollisionDetector, Item, nc, Asse
|
|||
}
|
||||
});
|
||||
|
||||
// // Grab sensors (left/right)
|
||||
// ["left", "right"].forEach(side => {
|
||||
// const sign = side === "left" ? -1 : 1;
|
||||
// addFixture({
|
||||
// shape: planck.Box(
|
||||
// r / 2 / R,
|
||||
// (h / 2 + r / 4) / R,
|
||||
// planck.Vec2(sign * r / 2 / R, h / 2 / R)
|
||||
// ),
|
||||
// density: 0,
|
||||
// friction: 0,
|
||||
// restitution: 0,
|
||||
// isSensor: true,
|
||||
// userData: {
|
||||
// onCollisionChange: function(isColliding, fixture) {
|
||||
// self.onFixtureWithinReach(isColliding, side, fixture);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// Grab sensors (left/right)
|
||||
["left", "right"].forEach(side => {
|
||||
const sign = side === "left" ? -1 : 1;
|
||||
addFixture({
|
||||
shape: planck.Box(
|
||||
r / 2 / R,
|
||||
(h / 2 + r / 4) / R,
|
||||
planck.Vec2(sign * r / 2 / R, h / 2 / R)
|
||||
),
|
||||
density: 0,
|
||||
friction: 0,
|
||||
restitution: 0,
|
||||
isSensor: true,
|
||||
userData: {
|
||||
onCollisionChange: function(isColliding, fixture) {
|
||||
self.onFixtureWithinReach(isColliding, side, fixture);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// // Area sensor
|
||||
// addFixture({
|
||||
// shape: planck.Box((w + a) / 2 / R, (h + a) / 2 / R, planck.Vec2(0, h / 2 / R)),
|
||||
// density: 0,
|
||||
// friction: 0,
|
||||
// restitution: 0,
|
||||
// isSensor: true,
|
||||
// userData: {
|
||||
// onCollisionChange: function(isColliding, fixture) {
|
||||
// var userData = fixture.getBody().getUserData();
|
||||
// if (userData instanceof Doll) {
|
||||
// var i = self.nearbyDolls.indexOf(userData);
|
||||
// if (isColliding && i === -1) self.nearbyDolls.push(userData);
|
||||
// else if (!isColliding && i !== -1) self.nearbyDolls.splice(i, 1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// Area sensor
|
||||
addFixture({
|
||||
shape: planck.Box((w + a) / 2 / R, (h + a) / 2 / R, planck.Vec2(0, h / 2 / R)),
|
||||
density: 0,
|
||||
friction: 0,
|
||||
restitution: 0,
|
||||
isSensor: true,
|
||||
userData: {
|
||||
onCollisionChange: function(isColliding, fixture) {
|
||||
var userData = fixture.getBody().getUserData();
|
||||
if (userData instanceof Doll) {
|
||||
var i = self.nearbyDolls.indexOf(userData);
|
||||
if (isColliding && i === -1) self.nearbyDolls.push(userData);
|
||||
else if (!isColliding && i !== -1) self.nearbyDolls.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Doll.prototype.setActionState = function(state) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue