@react-three/rapier 0.14.0-rc.0 → 0.14.0-rc.2

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.
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { PhysicsProps } from "./Physics";
3
+ interface FrameStepperProps {
4
+ type?: PhysicsProps["updateLoop"];
5
+ onStep: (dt: number) => void;
6
+ updatePriority?: number;
7
+ }
8
+ declare const _default: import("react").MemoExoticComponent<({ onStep, type, updatePriority }: FrameStepperProps) => JSX.Element>;
9
+ export default _default;
@@ -147,6 +147,30 @@ export interface PhysicsProps {
147
147
  * @defaultValue true
148
148
  **/
149
149
  interpolate?: boolean;
150
+ /**
151
+ * The update priority at which the physics simulation should run.
152
+ * Only used when `updateLoop` is set to "follow".
153
+ *
154
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#taking-over-the-render-loop
155
+ * @defaultValue undefined
156
+ */
157
+ updatePriority?: number;
158
+ /**
159
+ * Set the update loop strategy for the physics world.
160
+ *
161
+ * If set to "follow", the physics world will be stepped
162
+ * in a `useFrame` callback, managed by @react-three/fiber.
163
+ * You can use `updatePriority` prop to manage the scheduling.
164
+ *
165
+ * If set to "independent", the physics world will be stepped
166
+ * in a separate loop, not tied to the render loop.
167
+ * This is useful when using the "demand" `frameloop` strategy for the
168
+ * @react-three/fiber `<Canvas />`.
169
+ *
170
+ * @see https://docs.pmnd.rs/react-three-fiber/advanced/scaling-performance#on-demand-rendering
171
+ * @defaultValue "follow"
172
+ */
173
+ updateLoop?: "follow" | "independent";
150
174
  }
151
175
  /**
152
176
  * The main physics component used to create a physics world.
@@ -31,5 +31,51 @@ export declare const getColliderArgsFromGeometry: (geometry: BufferGeometry, col
31
31
  args: unknown[];
32
32
  offset: Vector3;
33
33
  };
34
- export declare const useColliderEvents: (getCollider: () => Collider, props: ColliderProps, events: EventMap) => void;
34
+ export declare const getActiveCollisionEventsFromProps: (props?: ColliderProps) => {
35
+ collision: boolean;
36
+ contactForce: boolean;
37
+ };
38
+ export declare const useColliderEvents: (getCollider: () => Collider, props: ColliderProps, events: EventMap, activeEvents?: {
39
+ collision?: boolean;
40
+ contactForce?: boolean;
41
+ }) => void;
42
+ export declare const cleanRigidBodyPropsForCollider: (props?: RigidBodyProps) => {
43
+ linearVelocity?: import("..").Vector3Array | undefined;
44
+ angularVelocity?: import("..").Vector3Array | undefined;
45
+ dominanceGroup?: number | undefined;
46
+ position?: import("@react-three/fiber").Vector3 | undefined;
47
+ rotation?: import("@react-three/fiber").Euler | undefined;
48
+ colliders?: RigidBodyAutoCollider | undefined;
49
+ friction?: number | undefined;
50
+ restitution?: number | undefined;
51
+ collisionGroups?: number | undefined;
52
+ solverGroups?: number | undefined;
53
+ onSleep?(): void;
54
+ onWake?(): void;
55
+ lockRotations?: boolean | undefined;
56
+ lockTranslations?: boolean | undefined;
57
+ enabledRotations?: import("..").Boolean3Array | undefined;
58
+ enabledTranslations?: import("..").Boolean3Array | undefined;
59
+ userData?: {
60
+ [key: string]: any;
61
+ } | undefined;
62
+ includeInvisible?: boolean | undefined;
63
+ transformState?: ((state: import("../components/Physics").RigidBodyState) => import("../components/Physics").RigidBodyState) | undefined;
64
+ name?: string | undefined;
65
+ shape?: ColliderShape | undefined;
66
+ args?: any;
67
+ principalAngularInertia?: import("..").Vector3Array | undefined;
68
+ restitutionCombineRule?: import("@dimforge/rapier3d-compat").CoefficientCombineRule | undefined;
69
+ frictionCombineRule?: import("@dimforge/rapier3d-compat").CoefficientCombineRule | undefined;
70
+ quaternion?: import("@react-three/fiber").Quaternion | undefined;
71
+ scale?: import("@react-three/fiber").Vector3 | undefined;
72
+ density?: number | undefined;
73
+ massProperties?: {
74
+ mass: number;
75
+ centerOfMass: import("@dimforge/rapier3d-compat").Vector;
76
+ principalAngularInertia: import("@dimforge/rapier3d-compat").Vector;
77
+ angularInertiaLocalFrame: import("@dimforge/rapier3d-compat").Rotation;
78
+ } | undefined;
79
+ sensor?: boolean | undefined;
80
+ };
35
81
  export {};