4.7 KiB
Planck.js API Doc › Globals › Sweep
Class: Sweep
This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin, which may not coincide with the center of mass. However, to support dynamics we must interpolate the center of mass position.
Hierarchy
- Sweep
Index
Constructors
Properties
Methods
Constructors
constructor
+ new Sweep(c?: Vec2, a?: number): Sweep
Defined in src/common/Sweep.ts:55
Parameters:
| Name | Type |
|---|---|
c? |
Vec2 |
a? |
number |
Returns: Sweep
Properties
a
• a: number
Defined in src/common/Sweep.ts:49
World angle
a0
• a0: number
Defined in src/common/Sweep.ts:55
alpha0
• alpha0: number
Defined in src/common/Sweep.ts:52
Fraction of the current time step in the range [0,1], c0 and a0 are c and a at alpha0.
c
• c: Vec2
Defined in src/common/Sweep.ts:46
World center position
c0
• c0: Vec2
Defined in src/common/Sweep.ts:54
localCenter
• localCenter: Vec2
Defined in src/common/Sweep.ts:43
Local center of mass position
Methods
advance
▸ advance(alpha: number): void
Defined in src/common/Sweep.ts:105
Advance the sweep forward, yielding a new initial state.
Parameters:
| Name | Type | Description |
|---|---|---|
alpha |
number | The new initial time |
Returns: void
clone
▸ clone(): Sweep
Defined in src/common/Sweep.ts:127
Returns: Sweep
forward
▸ forward(): void
Defined in src/common/Sweep.ts:113
Returns: void
getTransform
▸ getTransform(xf: Transform, beta: number): void
Defined in src/common/Sweep.ts:91
Get the interpolated transform at a specific time.
Parameters:
| Name | Type | Description |
|---|---|---|
xf |
Transform | - |
beta |
number | A factor in [0,1], where 0 indicates alpha0 |
Returns: void
normalize
▸ normalize(): void
Defined in src/common/Sweep.ts:121
normalize the angles in radians to be between -pi and pi.
Returns: void
set
▸ set(that: Sweep): void
Defined in src/common/Sweep.ts:138
Parameters:
| Name | Type |
|---|---|
that |
Sweep |
Returns: void
setLocalCenter
▸ setLocalCenter(localCenter: Vec2, xf: Transform): void
Defined in src/common/Sweep.ts:77
Parameters:
| Name | Type |
|---|---|
localCenter |
Vec2 |
xf |
Transform |
Returns: void
setTransform
▸ setTransform(xf: Transform): void
Defined in src/common/Sweep.ts:68
Parameters:
| Name | Type |
|---|---|
xf |
Transform |
Returns: void