collisionResponse

View sourcecollisionResponse(world: World): void

Resolves the current collision contacts with the configured velocity solver.

Physics2DPlugin registers this function directly in the repeating AppSchedule.Update schedule. The narrowphase populates the world’s Contacts resource before this system runs; this function does not find new contacts.

It first calls CollisionManifold.prepare for every current contact, passing the contact’s positions, velocities, rotations, and a fixed inverse timestep of 60. It then makes PhysicsSettings.velocitySolverIterations passes over the same contacts, calling CollisionManifold.solve once per contact in each pass. Changing that shared setting changes the number of solver passes for later updates.

Examples

import { AppSchedule } from '@wimaengine/core'
import { collisionResponse } from '@wimaengine/physics'

// Physics2DPlugin registers this automatically. Custom pipelines can use
// the same repeating update schedule:
app.registerSystem({
  schedule: AppSchedule.Update,
  system: collisionResponse
})

Parameters

NameDescriptionDefault
world——