Skip to main content

Ricochet2DCollisionContext

@zylem/game-lib


@zylem/game-lib / behavior / Ricochet2DCollisionContext

Interface: Ricochet2DCollisionContext

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/ricochet-2d.d.ts:31

Properties​

contact​

contact: object

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/ricochet-2d.d.ts:41

Contact information from the collision

normal?​

optional normal?: object

The collision normal

normal.x​

x: number

normal.y​

y: number

normal.z?​

optional z?: number

position?​

optional position?: object

Optional position where the collision occurred. If provided, used for precise offset calculation.

position.x​

x: number

position.y​

y: number

position.z?​

optional z?: number


entity?​

optional entity?: BaseEntityInterface

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/ricochet-2d.d.ts:32


otherEntity?​

optional otherEntity?: BaseEntityInterface

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/ricochet-2d.d.ts:33


otherPosition?​

optional otherPosition?: object

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/ricochet-2d.d.ts:71

Optional position of the other entity in the collision. Used for paddle-style deflection: offset = (contactY - otherY) / halfHeight.

x​

x: number

y​

y: number

z?​

optional z?: number


otherSize?​

optional otherSize?: object

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/ricochet-2d.d.ts:80

Optional size of the other entity (e.g., paddle size). If provided, used to normalize the offset based on the collision face.

x​

x: number

y​

y: number

z?​

optional z?: number


selfPosition?​

optional selfPosition?: object

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/ricochet-2d.d.ts:62

Optional position of the entity that owns this behavior. Used with contact.position for offset calculations.

x​

x: number

y​

y: number

z?​

optional z?: number


selfVelocity?​

optional selfVelocity?: object

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/ricochet-2d.d.ts:35

Current velocity of the entity (optional if entity is provided)

x​

x: number

y​

y: number

z?​

optional z?: number