dampenVelocity3D

View sourcedampenVelocity3D(world: World): void

Damps the linear velocity of every matching 3D entity.

Damping3DPlugin registers this exact function directly in the repeating AppSchedule.Update schedule. The registration does not specify a system group, so the schedule’s default group is used. The plugin also installs the required Linear3DDamping resource.

The query requires exactly Velocity3D. Before iterating, the system reads world.getResource(Linear3DDamping).value and calculates the multiplier 1 - value. It then scales each queried vector with Vector3.multiplyScalar using the same vector as the output, so every Velocity3D component is mutated in place. The resource must exist; a missing resource causes resource lookup to throw.

Examples

import { AppSchedule } from '@wimaengine/core'
import { dampenVelocity3D } from '@wimaengine/damping'

app.registerSystem({
  schedule: AppSchedule.Update,
  system: dampenVelocity3D
})
// Damping3DPlugin already installs this system and Linear3DDamping.

Parameters

NameDescriptionDefault
world

Update world containing Velocity3D and Linear3DDamping.

—