the-world-engine
Version:
three.js based, unity like game engine for browser
38 lines • 701 B
JavaScript
export class FixtureGroup {
jr;
Fr;
Or=new Set;
constructor(t, r) {
this.jr = t;
this.Fr = r;
}
add(t) {
const r = this.jr.CreateFixture(t);
this.Or.add(r);
return r;
}
remove(t) {
this.Or.delete(t);
this.jr.DestroyFixture(t);
}
clear() {
for (const t of this.Or) {
this.jr.DestroyFixture(t);
}
this.Or.clear();
}
foreachFixture(t) {
for (const r of this.Or) {
t(r);
}
}
contains(t) {
return this.Or.has(t);
}
get body() {
return this.jr;
}
get physicObject() {
return this.Fr;
}
}