UNPKG

the-world-engine

Version:

three.js based, unity like game engine for browser

83 lines (74 loc) 2.12 kB
import { b2_maxManifoldPoints, b2MakeNumberArray } from "../common/b2_settings.js"; import { b2BodyType } from "./b2_body.js"; export class b2DestructionListener { SayGoodbyeJoint(t) {} SayGoodbyeFixture(t) {} SayGoodbyeParticleGroup(t) {} SayGoodbyeParticle(t, e) {} } export class b2ContactFilter { ShouldCollide(t, e) { const r = t.GetBody(); const o = e.GetBody(); if (o.GetType() === b2BodyType.b2_staticBody && r.GetType() === b2BodyType.b2_staticBody) { return false; } if (!o.ShouldCollideConnected(r)) { return false; } const a = t.GetFilterData(); const n = e.GetFilterData(); if (a.groupIndex === n.groupIndex && a.groupIndex !== 0) { return a.groupIndex > 0; } const i = (a.maskBits & n.categoryBits) !== 0 && (a.categoryBits & n.maskBits) !== 0; return i; } ShouldCollideFixtureParticle(t, e, r) { return true; } ShouldCollideParticleParticle(t, e, r) { return true; } } b2ContactFilter.b2_defaultFilter = new b2ContactFilter; export class b2ContactImpulse { constructor() { this.normalImpulses = b2MakeNumberArray(b2_maxManifoldPoints); this.tangentImpulses = b2MakeNumberArray(b2_maxManifoldPoints); this.count = 0; } } export class b2ContactListener { BeginContact(t) {} EndContact(t) {} BeginContactFixtureParticle(t, e) {} EndContactFixtureParticle(t, e) {} BeginContactParticleParticle(t, e) {} EndContactParticleParticle(t, e) {} PreSolve(t, e) {} PostSolve(t, e) {} } b2ContactListener.b2_defaultListener = new b2ContactListener; export class b2QueryCallback { ReportFixture(t) { return true; } ReportParticle(t, e) { return false; } ShouldQueryParticleSystem(t) { return true; } } export class b2RayCastCallback { ReportFixture(t, e, r, o) { return o; } ReportParticle(t, e, r, o, a) { return 0; } ShouldQueryParticleSystem(t) { return true; } }