Physics · class
SweptStep
Explained in Your first game, Rigid bodies.
class SweptStepimport { SweptStep } from '@driftengine/physics';Constructor
new
constructor(options?: SweptStepOptions)| Parameter | Type | Description |
|---|---|---|
options? | SweptStepOptions |
Properties
| Name | Type | Description |
|---|---|---|
moveRefused | boolean | Whether the world refused a horizontal move this tick.MoreRead by anything that wants to tell a body that is stuck from one that is going in circles —
|
sinceStepUp | number | Seconds since the last successful step up. See stepGraceSec. |
Methods
beginTick
beginTick(dt: number): voidOpen a tick: forget last tick's refusal and age the step-up grace.
| Parameter | Type | Description |
|---|---|---|
dt | number |
More
Both counters live here or they live in two places, which is exactly the bug this seam
shipped with for one commit: the consumer kept its own sinceStepUp, advanced it, and the
engine's stayed pinned at whatever the last step set — so the grace below never expired and a
body perched on a rim was told, for ever, that it had just climbed onto a plateau.
slipOffContact
slipOffContact(body: Body, state: SweptState, dt: number, colliders: ColliderSet): boolean| Parameter | Type | Description |
|---|---|---|
body | Body | |
state | SweptState | |
dt | number | |
colliders | ColliderSet |
moveHorizontal
moveHorizontal(body: Body, state: SweptState, axis: Axis, want: number, colliders: ColliderSet, supported: boolean, world: WorldOpinion): void| Parameter | Type | Description |
|---|---|---|
body | Body | |
state | SweptState | |
axis | Axis | |
want | number | |
colliders | ColliderSet | |
supported | boolean | |
world | WorldOpinion |