UNPKG

@box2d/debug-draw

Version:

Debug drawing helper for @box2d

208 lines 7.13 kB
import { b2Transform } from "../common/b2_math"; import { b2Manifold, b2WorldManifold } from "../collision/b2_collision"; import { b2Body } from "./b2_body"; import { b2Fixture } from "./b2_fixture"; import { b2Shape } from "../collision/b2_shape"; import type { b2ContactListener } from "./b2_world_callbacks"; import { b2Readonly } from "../common/b2_readonly"; /** * Friction mixing law. The idea is to allow either fixture to drive the friction to zero. * For example, anything slides on ice. */ export declare function b2MixFriction(friction1: number, friction2: number): number; /** * Restitution mixing law. The idea is allow for anything to bounce off an inelastic surface. * For example, a superball bounces on anything. */ export declare function b2MixRestitution(restitution1: number, restitution2: number): number; /** * Restitution mixing law. This picks the lowest value. */ export declare function b2MixRestitutionThreshold(threshold1: number, threshold2: number): number; /** * A contact edge is used to connect bodies and contacts together * in a contact graph where each body is a node and each contact * is an edge. A contact edge belongs to a doubly linked list * maintained in each attached body. Each contact has two contact * nodes, one for each attached body. */ export declare class b2ContactEdge { /** Provides quick access to the other body attached. */ private m_other; get other(): b2Body; set other(value: b2Body); /** The contact */ readonly contact: b2Contact; /** The previous contact edge in the body's contact list */ prev: b2ContactEdge | null; /** The next contact edge in the body's contact list */ next: b2ContactEdge | null; constructor(contact: b2Contact); Reset(): void; } /** * The class manages contact between two shapes. A contact exists for each overlapping * AABB in the broad-phase (except if filtered). Therefore a contact object may exist * that has no contact points. */ export declare abstract class b2Contact<A extends b2Shape = b2Shape, B extends b2Shape = b2Shape> { /** * Used when crawling contact graph when forming islands. * * @internal protected */ m_islandFlag: boolean; /** * Set when the shapes are touching. * * @internal protected */ m_touchingFlag: boolean; /** * This contact can be disabled (by user) * * @internal protected */ m_enabledFlag: boolean; /** * This contact needs filtering because a fixture filter was changed. * * @internal protected */ m_filterFlag: boolean; /** * This bullet contact had a TOI event * * @internal protected */ m_bulletHitFlag: boolean; /** * This contact has a valid TOI in m_toi * * @internal protected */ m_toiFlag: boolean; /** * World pool and list pointers. * * @internal protected */ m_prev: b2Contact | null; /** @internal protected */ m_next: b2Contact | null; /** * Nodes for connecting bodies. * * @internal protected */ readonly m_nodeA: b2ContactEdge; /** @internal protected */ readonly m_nodeB: b2ContactEdge; /** @internal protected */ m_fixtureA: b2Fixture; /** @internal protected */ m_fixtureB: b2Fixture; /** @internal protected */ m_indexA: number; /** @internal protected */ m_indexB: number; /** @internal protected */ m_manifold: b2Manifold; /** @internal protected */ m_toiCount: number; /** @internal protected */ m_toi: number; /** @internal protected */ m_friction: number; /** @internal protected */ m_restitution: number; /** @internal protected */ m_restitutionThreshold: number; /** @internal protected */ m_tangentSpeed: number; protected m_oldManifold: b2Manifold; /** * Get the contact manifold. * Do not modify the manifold unless you understand the internals of Box2D. */ GetManifold(): b2Manifold; /** Get the world manifold. */ GetWorldManifold(worldManifold: b2WorldManifold): void; /** Is this contact touching? */ IsTouching(): boolean; /** * Enable/disable this contact. This can be used inside the pre-solve * contact listener. The contact is only disabled for the current * time step (or sub-step in continuous collisions). */ SetEnabled(flag: boolean): void; /** Has this contact been disabled? */ IsEnabled(): boolean; /** Get the next contact in the world's contact list. */ GetNext(): b2Contact | null; /** Get fixture A in this contact. */ GetFixtureA(): b2Fixture; /** Get the child primitive index for fixture A. */ GetChildIndexA(): number; /** Get fixture A in this contact. */ GetShapeA(): A; /** Get fixture B in this contact. */ GetFixtureB(): b2Fixture; /** Get the child primitive index for fixture B. */ GetChildIndexB(): number; GetShapeB(): B; /** Evaluate this contact with your own manifold and transforms. */ abstract Evaluate(manifold: b2Manifold, xfA: b2Readonly<b2Transform>, xfB: b2Readonly<b2Transform>): void; /** * Flag this contact for filtering. Filtering will occur the next time step. * * @internal protected */ FlagForFiltering(): void; /** * Override the default friction mixture. * You can call this in b2ContactListener::PreSolve. * This value persists until set or reset. */ SetFriction(friction: number): void; /** Get the friction. */ GetFriction(): number; /** Reset the friction mixture to the default value. */ ResetFriction(): void; /** * Override the default restitution mixture. * You can call this in b2ContactListener::PreSolve. * The value persists until you set or reset. */ SetRestitution(restitution: number): void; /** Get the restitution. */ GetRestitution(): number; /** Reset the restitution to the default value. */ ResetRestitution(): void; /** * Override the default restitution velocity threshold mixture. You can call this in b2ContactListener::PreSolve. * The value persists until you set or reset. */ SetRestitutionThreshold(threshold: number): void; /** * Get the restitution threshold. */ GetRestitutionThreshold(): number; /** * Reset the restitution threshold to the default value. */ ResetRestitutionThreshold(): void; /** Set the desired tangent speed for a conveyor belt behavior. In meters per second. */ SetTangentSpeed(speed: number): void; /** Get the desired tangent speed. In meters per second. */ GetTangentSpeed(): number; Reset(fixtureA: b2Fixture, indexA: number, fixtureB: b2Fixture, indexB: number): void; /** * Update the contact manifold and touching status. * Note: do not assume the fixture AABBs are overlapping or are valid. * * @internal protected */ Update(listener: b2ContactListener): void; } //# sourceMappingURL=b2_contact.d.ts.map