dacha 0.18.0-alpha.8 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/build/contrib/components/index.d.ts +1 -0
  2. package/build/contrib/components/index.js +1 -0
  3. package/build/contrib/components/interpolation/index.d.ts +85 -0
  4. package/build/contrib/components/interpolation/index.js +101 -0
  5. package/build/contrib/components/rigid-body/index.d.ts +108 -14
  6. package/build/contrib/components/rigid-body/index.js +191 -22
  7. package/build/contrib/systems/animator/index.d.ts +3 -2
  8. package/build/contrib/systems/animator/index.js +6 -3
  9. package/build/contrib/systems/behavior-system/system.d.ts +4 -2
  10. package/build/contrib/systems/behavior-system/system.js +11 -3
  11. package/build/contrib/systems/behavior-system/types.d.ts +7 -10
  12. package/build/contrib/systems/character-controller/index.d.ts +4 -2
  13. package/build/contrib/systems/character-controller/index.js +22 -17
  14. package/build/contrib/systems/character-controller/one-way-validator.d.ts +15 -0
  15. package/build/contrib/systems/character-controller/one-way-validator.js +73 -0
  16. package/build/contrib/systems/game-stats-meter/index.d.ts +4 -3
  17. package/build/contrib/systems/game-stats-meter/index.js +11 -10
  18. package/build/contrib/systems/index.d.ts +2 -0
  19. package/build/contrib/systems/index.js +1 -0
  20. package/build/contrib/systems/interpolator/api.d.ts +40 -0
  21. package/build/contrib/systems/interpolator/api.js +70 -0
  22. package/build/contrib/systems/interpolator/index.d.ts +3 -0
  23. package/build/contrib/systems/interpolator/index.js +2 -0
  24. package/build/contrib/systems/interpolator/system.d.ts +31 -0
  25. package/build/contrib/systems/interpolator/system.js +96 -0
  26. package/build/contrib/systems/interpolator/tests/helpers.d.ts +13 -0
  27. package/build/contrib/systems/interpolator/tests/helpers.js +45 -0
  28. package/build/contrib/systems/interpolator/utils.d.ts +5 -0
  29. package/build/contrib/systems/interpolator/utils.js +41 -0
  30. package/build/contrib/systems/physics-system/api.d.ts +45 -1
  31. package/build/contrib/systems/physics-system/api.js +49 -0
  32. package/build/contrib/systems/physics-system/consts.d.ts +13 -0
  33. package/build/contrib/systems/physics-system/consts.js +17 -0
  34. package/build/contrib/systems/physics-system/physics-system.d.ts +2 -2
  35. package/build/contrib/systems/physics-system/physics-system.js +24 -4
  36. package/build/contrib/systems/physics-system/subsystems/collision-detection/dynamic-aabb-tree/index.d.ts +1 -1
  37. package/build/contrib/systems/physics-system/subsystems/collision-detection/dynamic-aabb-tree/index.js +21 -15
  38. package/build/contrib/systems/physics-system/subsystems/collision-detection/index.d.ts +11 -11
  39. package/build/contrib/systems/physics-system/subsystems/collision-detection/index.js +133 -125
  40. package/build/contrib/systems/physics-system/subsystems/collision-detection/intersection-checkers/box-box/check-boxes-intersection.js +5 -3
  41. package/build/contrib/systems/physics-system/subsystems/collision-detection/intersection-checkers/box-box/utils.d.ts +1 -0
  42. package/build/contrib/systems/physics-system/subsystems/collision-detection/intersection-checkers/box-box/utils.js +2 -1
  43. package/build/contrib/systems/physics-system/subsystems/collision-detection/intersection-checkers/box-capsule/check-box-and-capsule-intersection.js +4 -1
  44. package/build/contrib/systems/physics-system/subsystems/collision-detection/intersection-checkers/box-segment/check-box-and-segment-intersection.js +4 -2
  45. package/build/contrib/systems/physics-system/subsystems/collision-detection/intersection-checkers/common/points.d.ts +2 -0
  46. package/build/contrib/systems/physics-system/subsystems/collision-detection/intersection-checkers/common/points.js +16 -0
  47. package/build/contrib/systems/physics-system/subsystems/collision-detection/intersection-checkers/index.js +2 -0
  48. package/build/contrib/systems/physics-system/subsystems/collision-detection/intersection-checkers/tests/helpers.js +3 -14
  49. package/build/contrib/systems/physics-system/subsystems/collision-detection/query-utils.d.ts +5 -0
  50. package/build/contrib/systems/physics-system/subsystems/collision-detection/query-utils.js +97 -81
  51. package/build/contrib/systems/physics-system/subsystems/collision-detection/shape-cast-checkers/tests/helpers.js +2 -7
  52. package/build/contrib/systems/physics-system/subsystems/collision-detection/tests/assertions.d.ts +1 -0
  53. package/build/contrib/systems/physics-system/subsystems/collision-detection/tests/assertions.js +7 -0
  54. package/build/contrib/systems/physics-system/subsystems/collision-detection/types.d.ts +0 -15
  55. package/build/contrib/systems/physics-system/subsystems/collision-detection/utils.d.ts +3 -0
  56. package/build/contrib/systems/physics-system/subsystems/collision-detection/utils.js +9 -0
  57. package/build/contrib/systems/physics-system/subsystems/constraint-solver/contact-state-manager.d.ts +63 -0
  58. package/build/contrib/systems/physics-system/subsystems/constraint-solver/contact-state-manager.js +170 -0
  59. package/build/contrib/systems/physics-system/subsystems/constraint-solver/contact-utils.d.ts +5 -0
  60. package/build/contrib/systems/physics-system/subsystems/constraint-solver/contact-utils.js +41 -0
  61. package/build/contrib/systems/physics-system/subsystems/constraint-solver/impulse-utils.d.ts +16 -0
  62. package/build/contrib/systems/physics-system/subsystems/constraint-solver/impulse-utils.js +77 -0
  63. package/build/contrib/systems/physics-system/subsystems/constraint-solver/index.d.ts +53 -4
  64. package/build/contrib/systems/physics-system/subsystems/constraint-solver/index.js +334 -116
  65. package/build/contrib/systems/physics-system/subsystems/constraint-solver/one-way-validator.d.ts +11 -0
  66. package/build/contrib/{utils → systems/physics-system/subsystems/constraint-solver}/one-way-validator.js +22 -25
  67. package/build/contrib/systems/physics-system/subsystems/constraint-solver/sleep-support-tracker.d.ts +13 -0
  68. package/build/contrib/systems/physics-system/subsystems/constraint-solver/sleep-support-tracker.js +42 -0
  69. package/build/contrib/systems/physics-system/subsystems/constraint-solver/tests/helpers.d.ts +4 -0
  70. package/build/contrib/systems/physics-system/subsystems/constraint-solver/tests/helpers.js +20 -0
  71. package/build/contrib/systems/physics-system/subsystems/physics/index.d.ts +15 -4
  72. package/build/contrib/systems/physics-system/subsystems/physics/index.js +131 -53
  73. package/build/contrib/systems/physics-system/subsystems/physics/mass-properties.d.ts +2 -0
  74. package/build/contrib/systems/physics-system/subsystems/physics/mass-properties.js +55 -0
  75. package/build/contrib/systems/physics-system/tests/helpers.d.ts +5 -2
  76. package/build/contrib/systems/physics-system/tests/helpers.js +11 -2
  77. package/build/contrib/systems/physics-system/types.d.ts +18 -2
  78. package/build/contrib/systems/renderer/actor-render-tree.js +15 -6
  79. package/build/contrib/systems/renderer/filters/index.d.ts +1 -1
  80. package/build/contrib/systems/renderer/filters/index.js +1 -1
  81. package/build/contrib/systems/renderer/material/index.d.ts +2 -1
  82. package/build/contrib/systems/renderer/material/index.js +1 -1
  83. package/build/contrib/systems/renderer/renderer.d.ts +2 -2
  84. package/build/contrib/systems/renderer/renderer.js +3 -4
  85. package/build/contrib/systems/renderer/types.d.ts +0 -3
  86. package/build/engine/data-lib/index.d.ts +1 -1
  87. package/build/engine/data-lib/index.js +1 -1
  88. package/build/engine/data-lib/pool.d.ts +9 -0
  89. package/build/engine/data-lib/pool.js +19 -0
  90. package/build/engine/engine.js +4 -1
  91. package/build/engine/game-loop.d.ts +3 -1
  92. package/build/engine/game-loop.js +11 -8
  93. package/build/engine/math-lib/math/ops.d.ts +16 -0
  94. package/build/engine/math-lib/math/ops.js +25 -0
  95. package/build/engine/scene/scene-manager.d.ts +4 -1
  96. package/build/engine/scene/scene-manager.js +5 -1
  97. package/build/engine/system/index.d.ts +1 -1
  98. package/build/engine/system/system.d.ts +10 -11
  99. package/build/engine/system/system.js +5 -2
  100. package/build/engine/time.d.ts +54 -0
  101. package/build/engine/time.js +77 -0
  102. package/build/index.d.ts +2 -1
  103. package/package.json +1 -1
  104. package/build/contrib/systems/physics-system/subsystems/collision-detection/dispersion-calculator/index.d.ts +0 -11
  105. package/build/contrib/systems/physics-system/subsystems/collision-detection/dispersion-calculator/index.js +0 -41
  106. package/build/contrib/utils/one-way-validator.d.ts +0 -12
  107. package/build/engine/data-lib/sort/index.d.ts +0 -1
  108. package/build/engine/data-lib/sort/index.js +0 -1
  109. package/build/engine/data-lib/sort/insertion-sort.d.ts +0 -1
  110. package/build/engine/data-lib/sort/insertion-sort.js +0 -14
@@ -3,6 +3,7 @@ export { KeyboardControl, type KeyboardControlConfig, } from './keyboard-control
3
3
  export { Collider, type ColliderConfig, type ColliderShape, type ColliderType, type BoxColliderShape, type CircleColliderShape, type SegmentColliderShape, type CapsuleColliderShape, } from './collider';
4
4
  export { RigidBody, type RigidBodyConfig } from './rigid-body';
5
5
  export { CharacterBody, type CharacterBodyConfig } from './character-body';
6
+ export { Interpolation, type InterpolationConfig, type InterpolationMode, } from './interpolation';
6
7
  export { Animatable, type AnimatableConfig } from './animatable';
7
8
  export { Sprite, type SpriteConfig } from './sprite';
8
9
  export { Transform, type TransformConfig } from './transform';
@@ -3,6 +3,7 @@ export { KeyboardControl, } from './keyboard-control';
3
3
  export { Collider, } from './collider';
4
4
  export { RigidBody } from './rigid-body';
5
5
  export { CharacterBody } from './character-body';
6
+ export { Interpolation, } from './interpolation';
6
7
  export { Animatable } from './animatable';
7
8
  export { Sprite } from './sprite';
8
9
  export { Transform } from './transform';
@@ -0,0 +1,85 @@
1
+ import { Component } from '../../../engine/component';
2
+ export type InterpolationMode = 'interpolate' | 'extrapolate';
3
+ export interface InterpolationConfig {
4
+ mode?: InterpolationMode;
5
+ snapThreshold?: number;
6
+ disabled?: boolean;
7
+ }
8
+ /**
9
+ * Component that smooths rendering of actors moved during fixed updates.
10
+ *
11
+ * Interpolator keeps local-space snapshots of the actor's Transform around
12
+ * each fixed step and blends them into the render-facing
13
+ * `renderX`/`renderY`/`renderRotation` values every render frame using
14
+ * `Time.alpha`. The renderer prefers these values over the Transform.
15
+ *
16
+ * The Transform component always holds the authoritative simulation state.
17
+ * Interpolated values are only visible to the renderer and to consumers of
18
+ * InterpolatorAPI, so simulation code can never accidentally read a
19
+ * visually smoothed but physically incorrect position.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * actor.setComponent(new Interpolation({ mode: 'interpolate' }));
24
+ *
25
+ * // After teleporting the actor, skip smoothing for the jump:
26
+ * actor.getComponent(Transform).world.position.x = 500;
27
+ * actor.getComponent(Interpolation).snap();
28
+ * ```
29
+ *
30
+ * @category Components
31
+ */
32
+ export declare class Interpolation extends Component {
33
+ /**
34
+ * How render values are produced. `interpolate` blends between the last
35
+ * two fixed steps (smooth, adds up to one fixed step of visual latency).
36
+ * `extrapolate` projects the latest step forward using the rigid body
37
+ * velocity (no added latency, may briefly overshoot on impacts).
38
+ *
39
+ * `extrapolate` uses the world-space rigid body velocity against
40
+ * local-space snapshots, so it is intended for root-level actors.
41
+ */
42
+ mode: InterpolationMode;
43
+ /**
44
+ * Maximum distance in world units treated as continuous movement between
45
+ * two fixed steps. Larger jumps snap instead of gliding. `0` disables
46
+ * the automatic snap detection.
47
+ */
48
+ snapThreshold: number;
49
+ /** Whether smoothing is turned off. The renderer falls back to Transform. */
50
+ disabled: boolean;
51
+ /** @internal Local-space position X from the previous fixed step */
52
+ _prevX: number;
53
+ /** @internal Local-space position Y from the previous fixed step */
54
+ _prevY: number;
55
+ /** @internal Local-space rotation from the previous fixed step */
56
+ _prevRotation: number;
57
+ /** @internal Local-space position X from the latest fixed step */
58
+ _currX: number;
59
+ /** @internal Local-space position Y from the latest fixed step */
60
+ _currY: number;
61
+ /** @internal Local-space rotation from the latest fixed step */
62
+ _currRotation: number;
63
+ /** @internal Whether snapshots have been initialized since (re)enabling */
64
+ _initialized: boolean;
65
+ /** @internal Whether smoothing should be skipped at the next opportunity */
66
+ _snapRequested: boolean;
67
+ /** Render-facing local-space position X, written by Interpolator */
68
+ renderX: number;
69
+ /** Render-facing local-space position Y, written by Interpolator */
70
+ renderY: number;
71
+ /** Render-facing local-space rotation, written by Interpolator */
72
+ renderRotation: number;
73
+ constructor(config?: InterpolationConfig);
74
+ /**
75
+ * Whether the render-facing values hold a valid snapshot yet. `false`
76
+ * until the Interpolator takes its first snapshot after the component is
77
+ * (re)enabled.
78
+ */
79
+ get initialized(): boolean;
80
+ /**
81
+ * Requests an immediate jump to the Transform instead of
82
+ * smoothing towards it. Call right after teleporting the actor.
83
+ */
84
+ snap(): void;
85
+ }
@@ -0,0 +1,101 @@
1
+ import { Component } from '../../../engine/component';
2
+ /**
3
+ * Component that smooths rendering of actors moved during fixed updates.
4
+ *
5
+ * Interpolator keeps local-space snapshots of the actor's Transform around
6
+ * each fixed step and blends them into the render-facing
7
+ * `renderX`/`renderY`/`renderRotation` values every render frame using
8
+ * `Time.alpha`. The renderer prefers these values over the Transform.
9
+ *
10
+ * The Transform component always holds the authoritative simulation state.
11
+ * Interpolated values are only visible to the renderer and to consumers of
12
+ * InterpolatorAPI, so simulation code can never accidentally read a
13
+ * visually smoothed but physically incorrect position.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * actor.setComponent(new Interpolation({ mode: 'interpolate' }));
18
+ *
19
+ * // After teleporting the actor, skip smoothing for the jump:
20
+ * actor.getComponent(Transform).world.position.x = 500;
21
+ * actor.getComponent(Interpolation).snap();
22
+ * ```
23
+ *
24
+ * @category Components
25
+ */
26
+ export class Interpolation extends Component {
27
+ /**
28
+ * How render values are produced. `interpolate` blends between the last
29
+ * two fixed steps (smooth, adds up to one fixed step of visual latency).
30
+ * `extrapolate` projects the latest step forward using the rigid body
31
+ * velocity (no added latency, may briefly overshoot on impacts).
32
+ *
33
+ * `extrapolate` uses the world-space rigid body velocity against
34
+ * local-space snapshots, so it is intended for root-level actors.
35
+ */
36
+ mode;
37
+ /**
38
+ * Maximum distance in world units treated as continuous movement between
39
+ * two fixed steps. Larger jumps snap instead of gliding. `0` disables
40
+ * the automatic snap detection.
41
+ */
42
+ snapThreshold;
43
+ /** Whether smoothing is turned off. The renderer falls back to Transform. */
44
+ disabled;
45
+ /** @internal Local-space position X from the previous fixed step */
46
+ _prevX;
47
+ /** @internal Local-space position Y from the previous fixed step */
48
+ _prevY;
49
+ /** @internal Local-space rotation from the previous fixed step */
50
+ _prevRotation;
51
+ /** @internal Local-space position X from the latest fixed step */
52
+ _currX;
53
+ /** @internal Local-space position Y from the latest fixed step */
54
+ _currY;
55
+ /** @internal Local-space rotation from the latest fixed step */
56
+ _currRotation;
57
+ /** @internal Whether snapshots have been initialized since (re)enabling */
58
+ _initialized;
59
+ /** @internal Whether smoothing should be skipped at the next opportunity */
60
+ _snapRequested;
61
+ /** Render-facing local-space position X, written by Interpolator */
62
+ renderX;
63
+ /** Render-facing local-space position Y, written by Interpolator */
64
+ renderY;
65
+ /** Render-facing local-space rotation, written by Interpolator */
66
+ renderRotation;
67
+ constructor(config = {}) {
68
+ super();
69
+ const { mode = 'interpolate', snapThreshold = 0, disabled = false, } = config;
70
+ this.mode = mode;
71
+ this.snapThreshold = snapThreshold;
72
+ this.disabled = disabled;
73
+ this._prevX = 0;
74
+ this._prevY = 0;
75
+ this._prevRotation = 0;
76
+ this._currX = 0;
77
+ this._currY = 0;
78
+ this._currRotation = 0;
79
+ this._initialized = false;
80
+ this._snapRequested = false;
81
+ this.renderX = 0;
82
+ this.renderY = 0;
83
+ this.renderRotation = 0;
84
+ }
85
+ /**
86
+ * Whether the render-facing values hold a valid snapshot yet. `false`
87
+ * until the Interpolator takes its first snapshot after the component is
88
+ * (re)enabled.
89
+ */
90
+ get initialized() {
91
+ return this._initialized;
92
+ }
93
+ /**
94
+ * Requests an immediate jump to the Transform instead of
95
+ * smoothing towards it. Call right after teleporting the actor.
96
+ */
97
+ snap() {
98
+ this._snapRequested = true;
99
+ }
100
+ }
101
+ Interpolation.componentName = 'Interpolation';
@@ -1,21 +1,42 @@
1
1
  import { Component } from '../../../engine/component';
2
- import { Vector2 } from '../../../engine/math-lib';
2
+ import { Vector2, type Point } from '../../../engine/math-lib';
3
3
  export type RigidBodyType = 'dynamic' | 'static' | 'kinematic';
4
4
  export interface RigidBodyConfig {
5
5
  type: RigidBodyType;
6
6
  mass?: number;
7
7
  gravityScale?: number;
8
8
  linearDamping?: number;
9
+ angularDamping?: number;
10
+ lockRotation?: boolean;
11
+ autoSleep?: boolean;
12
+ restitution?: number;
13
+ friction?: number;
9
14
  disabled: boolean;
10
15
  oneWay: boolean;
11
16
  oneWayNormalX?: number;
12
17
  oneWayNormalY?: number;
13
18
  }
19
+ interface PointForce {
20
+ force: Vector2;
21
+ position: Point;
22
+ }
23
+ interface PointImpulse {
24
+ impulse: Vector2;
25
+ position: Point;
26
+ }
14
27
  /**
15
28
  * RigidBody component for defining rigid body physics.
16
29
  *
17
- * Defines the physics properties for an actor. It's used by the
18
- * physics system to apply forces and impulses to the actor.
30
+ * Defines the physics properties for an actor. Dynamic bodies react to forces,
31
+ * impulses, gravity, collisions, and rotation. Static and kinematic bodies can
32
+ * participate in collisions but are not moved by solver impulses.
33
+ *
34
+ * Physics is simulated in world space.
35
+ *
36
+ * Rigid bodies may be parented only to actors with static transforms. A moving
37
+ * parent (for example, a dynamic or kinematic rigid body) and the physics
38
+ * simulation would both control the child's transform, so the result is
39
+ * undefined.
19
40
  *
20
41
  * @example
21
42
  * ```typescript
@@ -40,24 +61,54 @@ export interface RigidBodyConfig {
40
61
  export declare class RigidBody extends Component {
41
62
  private _mass;
42
63
  private _inverseMass;
64
+ private _inertia;
65
+ private _inverseInertia;
66
+ private _restitution;
67
+ private _friction;
43
68
  /** @internal Pending one-step kinematic movement target */
44
69
  _movementTarget: Vector2 | null;
70
+ /** @internal Linear velocity from the start of the current physics step */
71
+ _prevLinearVelocity: Vector2;
72
+ /** @internal Angular velocity from the start of the current physics step */
73
+ _prevAngularVelocity: number;
74
+ /** @internal Temporary solver velocity used for contact separation */
75
+ _biasLinearVelocity: Vector2;
76
+ /** @internal Temporary solver angular velocity used for contact separation */
77
+ _biasAngularVelocity: number;
78
+ /** @internal Time this body has stayed below automatic sleep thresholds */
79
+ _sleepTime: number;
45
80
  /** Body type that defines how the rigid body participates in simulation */
46
81
  readonly type: RigidBodyType;
47
- /** Gravity scale of the rigid body */
82
+ /** Gravity multiplier. `0` ignores gravity, `1` uses normal world gravity. */
48
83
  gravityScale: number;
49
- /** Linear damping value used to slow down movement over time */
84
+ /** Linear damping used to slow down movement over time */
50
85
  linearDamping: number;
51
- /** Current linear velocity of the rigid body */
86
+ /** Angular damping used to slow down rotation over time */
87
+ angularDamping: number;
88
+ /** Current linear velocity in world units per second */
52
89
  linearVelocity: Vector2;
90
+ /** Current angular velocity of the rigid body in radians per second */
91
+ angularVelocity: number;
92
+ /** Whether dynamic rotation is locked. Locked bodies do not spin from torque or contacts. */
93
+ lockRotation: boolean;
53
94
  /** Whether rigid body simulation is disabled */
54
95
  disabled: boolean;
55
96
  /** Whether rigid body is sleeping */
56
97
  sleeping: boolean;
57
- /** Force applied to the rigid body */
58
- force: Vector2;
59
- /** Impulse applied to the rigid body */
60
- impulse: Vector2;
98
+ /** Whether this body may be put to sleep automatically when settled */
99
+ autoSleep: boolean;
100
+ /** @internal Force applied at the rigid body center */
101
+ _centralForce: Vector2;
102
+ /** @internal Impulse applied at the rigid body center */
103
+ _centralImpulse: Vector2;
104
+ /** @internal Forces applied at world-space positions */
105
+ _pointForces: PointForce[];
106
+ /** @internal Impulses applied at world-space positions */
107
+ _pointImpulses: PointImpulse[];
108
+ /** @internal Torque applied to the rigid body */
109
+ _torque: number;
110
+ /** @internal Angular impulse applied to the rigid body */
111
+ _angularImpulse: number;
61
112
  /** Whether contacts should only be resolved from one side */
62
113
  oneWay: boolean;
63
114
  /** Local-space normal that points toward the blocking side */
@@ -71,6 +122,7 @@ export declare class RigidBody extends Component {
71
122
  /**
72
123
  * Sets the mass used by dynamic bodies.
73
124
  *
125
+ * Mass is an authored, kilogram-like scalar.
74
126
  * Non-positive values make the body immovable by forces and impulses.
75
127
  */
76
128
  set mass(value: number);
@@ -80,18 +132,59 @@ export declare class RigidBody extends Component {
80
132
  * Bodies with zero or negative mass return `0`.
81
133
  */
82
134
  get inverseMass(): number;
135
+ get inertia(): number;
136
+ /**
137
+ * Moment of inertia used by dynamic bodies.
138
+ *
139
+ * Inertia is the rotational equivalent of mass: higher values make the body
140
+ * harder to spin. It is automatically computed from the collider shape, mass,
141
+ * and collider offset every physics step, so user code usually should only
142
+ * read this value.
143
+ */
144
+ set inertia(value: number);
145
+ /**
146
+ * Returns the inverse moment of inertia.
147
+ *
148
+ * This is the solver-friendly form of inertia. Static bodies, kinematic
149
+ * bodies, locked rotation, or non-positive inertia return `0`.
150
+ */
151
+ get inverseInertia(): number;
152
+ /** Bounciness used by contact resolution. `0` does not bounce, `1` keeps full bounce speed. */
153
+ get restitution(): number;
154
+ set restitution(value: number);
155
+ /** Surface friction used by contact resolution. Higher values reduce sliding more strongly. */
156
+ get friction(): number;
157
+ set friction(value: number);
83
158
  /**
84
159
  * Adds a continuous force to a dynamic body for the next physics step.
85
160
  *
86
- * Affects only active dynamic bodies.
161
+ * Affects only active dynamic bodies. When `position` is provided, it is a
162
+ * world-space point where the force is applied; off-center forces can also
163
+ * rotate the body.
87
164
  */
88
- applyForce(force: Vector2): void;
165
+ applyForce(force: Vector2, position?: Point): void;
89
166
  /**
90
167
  * Adds an instantaneous impulse to a dynamic body for the next physics step.
91
168
  *
92
- * Affects only active dynamic bodies.
169
+ * Affects only active dynamic bodies. An impulse is a one-step velocity kick.
170
+ * When `position` is provided, it is a world-space point where the impulse is
171
+ * applied; off-center impulses can also rotate the body.
172
+ */
173
+ applyImpulse(impulse: Vector2, position?: Point): void;
174
+ /**
175
+ * Adds a continuous torque to a dynamic body for the next physics step.
176
+ *
177
+ * Torque is rotational force: it changes angular velocity over time. Affects
178
+ * only active dynamic bodies with unlocked rotation.
179
+ */
180
+ applyTorque(torque: number): void;
181
+ /**
182
+ * Adds an instantaneous angular impulse to a dynamic body for the next physics step.
183
+ *
184
+ * Angular impulse is an immediate rotational kick. Affects only active dynamic
185
+ * bodies with unlocked rotation.
93
186
  */
94
- applyImpulse(impulse: Vector2): void;
187
+ applyAngularImpulse(impulse: number): void;
95
188
  /**
96
189
  * Marks the rigid body as awake so it can be simulated.
97
190
  */
@@ -112,3 +205,4 @@ export declare class RigidBody extends Component {
112
205
  */
113
206
  movePosition(position: Vector2): void;
114
207
  }
208
+ export {};