mujoco-react 0.3.0 → 1.0.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.
- package/README.md +137 -62
- package/dist/index.d.ts +54 -54
- package/dist/index.js +47 -32
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/src/components/ContactMarkers.tsx +9 -5
- package/src/components/Debug.tsx +5 -3
- package/src/components/DragInteraction.tsx +4 -2
- package/src/components/FlexRenderer.tsx +3 -2
- package/src/components/SceneRenderer.tsx +5 -2
- package/src/components/TendonRenderer.tsx +3 -2
- package/src/core/MujocoCanvas.tsx +1 -5
- package/src/core/MujocoPhysics.tsx +79 -0
- package/src/core/MujocoSimProvider.tsx +3 -11
- package/src/core/SceneLoader.ts +2 -8
- package/src/index.ts +2 -0
- package/src/types.ts +0 -10
package/README.md
CHANGED
|
@@ -55,68 +55,104 @@ function App() {
|
|
|
55
55
|
|
|
56
56
|
## Architecture
|
|
57
57
|
|
|
58
|
+
Two ways to set up your scene:
|
|
59
|
+
|
|
60
|
+
### `<MujocoCanvas>` — Quick Start
|
|
61
|
+
|
|
62
|
+
Wraps R3F `<Canvas>` for you. Fastest path to a working scene:
|
|
63
|
+
|
|
58
64
|
```
|
|
59
65
|
<MujocoProvider> <- WASM module lifecycle
|
|
60
|
-
<MujocoCanvas config={...}> <-
|
|
61
|
-
<OrbitControls /> <- You add your own controls
|
|
66
|
+
<MujocoCanvas config={...}> <- R3F Canvas + physics context
|
|
62
67
|
<SceneRenderer /> <- Syncs MuJoCo bodies to Three.js meshes
|
|
63
68
|
<IkController config={..}> <- Opt-in controller plugin
|
|
64
|
-
<IkGizmo />
|
|
69
|
+
<IkGizmo />
|
|
65
70
|
</IkController>
|
|
66
71
|
<YourController /> <- Bring your own controller
|
|
67
72
|
<YourLights /> <- You compose your own scene
|
|
68
|
-
<YourGrid />
|
|
69
73
|
</MujocoCanvas>
|
|
70
74
|
</MujocoProvider>
|
|
71
75
|
```
|
|
72
76
|
|
|
73
|
-
|
|
77
|
+
### `<MujocoPhysics>` — Bring Your Own Canvas
|
|
74
78
|
|
|
75
|
-
|
|
79
|
+
Use inside your own `<Canvas>` for full control over gl settings, post-processing, and R3F context composition:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
<MujocoProvider>
|
|
83
|
+
<Canvas shadows camera={...} gl={...}> <- Your Canvas, your settings
|
|
84
|
+
<MujocoPhysics config={config}> <- Physics context only
|
|
85
|
+
<SceneRenderer />
|
|
86
|
+
<YourController />
|
|
87
|
+
</MujocoPhysics>
|
|
88
|
+
<OrbitControls />
|
|
89
|
+
<EffectComposer>...</EffectComposer> <- Post-processing, etc.
|
|
90
|
+
</Canvas>
|
|
91
|
+
</MujocoProvider>
|
|
92
|
+
```
|
|
76
93
|
|
|
77
|
-
|
|
94
|
+
The library provides **only MuJoCo engine concerns**: WASM lifecycle, physics stepping, and body rendering. Controllers (IK, teleoperation, RL policies) are composable plugins you opt into — or bring your own.
|
|
78
95
|
|
|
79
|
-
|
|
96
|
+
## Bring Your Own Controller
|
|
80
97
|
|
|
81
|
-
|
|
98
|
+
**Controllers are just React components.** Write a function that calls `useBeforePhysicsStep` to drive `data.ctrl` each frame, return `null`, and drop it into your scene tree. No base class, no registration — just hooks.
|
|
82
99
|
|
|
83
100
|
```tsx
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
101
|
+
import { useBeforePhysicsStep } from 'mujoco-react';
|
|
102
|
+
|
|
103
|
+
function MyController() {
|
|
104
|
+
useBeforePhysicsStep((_model, data) => {
|
|
105
|
+
data.ctrl[0] = Math.sin(data.time); // sine wave on actuator 0
|
|
106
|
+
data.ctrl[1] = data.sensordata[0] * -0.5; // feedback from a sensor
|
|
107
|
+
});
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Drop it in:
|
|
112
|
+
<MujocoCanvas config={config}>
|
|
113
|
+
<SceneRenderer />
|
|
114
|
+
<MyController />
|
|
115
|
+
</MujocoCanvas>
|
|
87
116
|
```
|
|
88
117
|
|
|
89
|
-
|
|
90
|
-
|--------|------|---------|-------------|
|
|
91
|
-
| `siteName` | `string` | **required** | MuJoCo site to track |
|
|
92
|
-
| `numJoints` | `number` | **required** | Number of joints for IK |
|
|
93
|
-
| `ikSolveFn` | `IKSolveFn` | built-in DLS | Custom solver function |
|
|
94
|
-
| `damping` | `number` | `0.01` | DLS damping |
|
|
95
|
-
| `maxIterations` | `number` | `50` | Max solver iterations |
|
|
118
|
+
This is the primary way to use the library. IK, teleoperation, RL policies, state machines — they're all just components that read input and write to `data.ctrl`.
|
|
96
119
|
|
|
97
|
-
###
|
|
120
|
+
### Bring Your Own IK
|
|
98
121
|
|
|
99
|
-
|
|
122
|
+
The built-in `<IkController>` uses a generic Damped Least-Squares solver, but you can plug in **any** IK solver — analytical, learned, or from another library:
|
|
100
123
|
|
|
101
124
|
```tsx
|
|
102
|
-
|
|
125
|
+
import type { IKSolveFn } from 'mujoco-react';
|
|
126
|
+
|
|
127
|
+
const myIK: IKSolveFn = (pos, quat, currentQ) => {
|
|
128
|
+
return myAnalyticalSolver(pos, currentQ); // return joint angles or null
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
<IkController config={{ siteName: 'tcp', numJoints: 7, ikSolveFn: myIK }}>
|
|
132
|
+
<IkGizmo />
|
|
133
|
+
</IkController>
|
|
103
134
|
```
|
|
104
135
|
|
|
105
|
-
|
|
136
|
+
Or skip `<IkController>` entirely and solve IK yourself inside `useBeforePhysicsStep`:
|
|
106
137
|
|
|
107
138
|
```tsx
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
139
|
+
function MyIKController() {
|
|
140
|
+
useBeforePhysicsStep((model, data) => {
|
|
141
|
+
const joints = myCustomIKSolve(model, data);
|
|
142
|
+
if (joints) {
|
|
143
|
+
for (let i = 0; i < joints.length; i++) data.ctrl[i] = joints[i];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return null;
|
|
111
147
|
}
|
|
112
148
|
```
|
|
113
149
|
|
|
114
|
-
### `createController<TConfig>(
|
|
150
|
+
### `createController<TConfig>()` Factory
|
|
115
151
|
|
|
116
|
-
|
|
152
|
+
For reusable controller plugins with typed config and default merging:
|
|
117
153
|
|
|
118
154
|
```tsx
|
|
119
|
-
import { createController, useBeforePhysicsStep
|
|
155
|
+
import { createController, useBeforePhysicsStep } from 'mujoco-react';
|
|
120
156
|
|
|
121
157
|
interface MyConfig {
|
|
122
158
|
gain: number;
|
|
@@ -138,6 +174,36 @@ export const MyController = createController<MyConfig>(
|
|
|
138
174
|
// Usage: <MyController config={{ gain: 2.0, targetJoint: 'shoulder' }} />
|
|
139
175
|
```
|
|
140
176
|
|
|
177
|
+
### Built-in `<IkController>`
|
|
178
|
+
|
|
179
|
+
The library ships one controller out of the box — an IK gizmo you can drop in for interactive end-effector control:
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
<IkController config={{ siteName: 'tcp', numJoints: 7 }}>
|
|
183
|
+
<IkGizmo />
|
|
184
|
+
</IkController>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
| Config | Type | Default | Description |
|
|
188
|
+
|--------|------|---------|-------------|
|
|
189
|
+
| `siteName` | `string` | **required** | MuJoCo site to track |
|
|
190
|
+
| `numJoints` | `number` | **required** | Number of joints for IK |
|
|
191
|
+
| `ikSolveFn` | `IKSolveFn` | built-in DLS | Custom solver function |
|
|
192
|
+
| `damping` | `number` | `0.01` | DLS damping |
|
|
193
|
+
| `maxIterations` | `number` | `50` | Max solver iterations |
|
|
194
|
+
|
|
195
|
+
Access IK state from inside `<IkController>` with `useIk()`:
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
const { setIkEnabled, moveTarget, solveIK } = useIk();
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Pass `{ optional: true }` for components that may or may not be inside an `<IkController>`:
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
const ikCtx = useIk({ optional: true });
|
|
205
|
+
```
|
|
206
|
+
|
|
141
207
|
## Loading Models
|
|
142
208
|
|
|
143
209
|
Models are loaded from any HTTP source via `SceneConfig.baseUrl`. Defaults to [MuJoCo Menagerie](https://github.com/google-deepmind/mujoco_menagerie) on GitHub.
|
|
@@ -233,13 +299,39 @@ Thin wrapper around R3F `<Canvas>`. Accepts all R3F Canvas props plus:
|
|
|
233
299
|
| `substeps` | `number` | mj_step calls per frame |
|
|
234
300
|
| `paused` | `boolean` | Declarative pause |
|
|
235
301
|
| `speed` | `number` | Simulation speed multiplier |
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
302
|
+
|
|
303
|
+
### `<MujocoPhysics>`
|
|
304
|
+
|
|
305
|
+
Physics provider for use inside your own R3F `<Canvas>`. Same physics props as `<MujocoCanvas>` without the Canvas wrapper. Accepts a `ref` for the `MujocoSimAPI`.
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
<MujocoProvider>
|
|
309
|
+
<Canvas shadows camera={{ position: [2, 2, 2] }}>
|
|
310
|
+
<MujocoPhysics ref={apiRef} config={config} paused={paused}>
|
|
311
|
+
<SceneRenderer />
|
|
312
|
+
<MyController />
|
|
313
|
+
</MujocoPhysics>
|
|
314
|
+
<OrbitControls />
|
|
315
|
+
</Canvas>
|
|
316
|
+
</MujocoProvider>
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
| Prop | Type | Description |
|
|
320
|
+
|------|------|-------------|
|
|
321
|
+
| `config` | `SceneConfig` | **Required.** Scene/robot configuration |
|
|
322
|
+
| `onReady` | `(api: MujocoSimAPI) => void` | Fires when model is loaded |
|
|
323
|
+
| `onError` | `(error: Error) => void` | Fires on scene load failure |
|
|
324
|
+
| `onStep` | `(time: number) => void` | Called each physics step |
|
|
325
|
+
| `onSelection` | `(bodyId: number, name: string) => void` | Called on double-click |
|
|
326
|
+
| `gravity` | `[number, number, number]` | Override model gravity |
|
|
327
|
+
| `timestep` | `number` | Override model.opt.timestep |
|
|
328
|
+
| `substeps` | `number` | mj_step calls per frame |
|
|
329
|
+
| `paused` | `boolean` | Declarative pause |
|
|
330
|
+
| `speed` | `number` | Simulation speed multiplier |
|
|
239
331
|
|
|
240
332
|
### `<SceneRenderer />`
|
|
241
333
|
|
|
242
|
-
Syncs MuJoCo bodies to Three.js meshes every frame. Must be inside `<MujocoCanvas>`.
|
|
334
|
+
Syncs MuJoCo bodies to Three.js meshes every frame. Must be inside `<MujocoCanvas>` or `<MujocoPhysics>`.
|
|
243
335
|
|
|
244
336
|
### `<IkGizmo />`
|
|
245
337
|
|
|
@@ -255,6 +347,16 @@ drei PivotControls gizmo that tracks a MuJoCo site and drives IK on drag. Must b
|
|
|
255
347
|
|
|
256
348
|
Click-drag to apply spring forces to bodies. Raycasts to find bodies, applies `F = (mouseWorld - grabWorld) * body_mass * stiffness` via `mj_applyFT`.
|
|
257
349
|
|
|
350
|
+
### R3F Group Props
|
|
351
|
+
|
|
352
|
+
All visual components (`SceneRenderer`, `DragInteraction`, `ContactMarkers`, `Debug`, `TendonRenderer`, `FlexRenderer`) accept standard R3F group props — `position`, `rotation`, `scale`, `visible`, etc.
|
|
353
|
+
|
|
354
|
+
```tsx
|
|
355
|
+
<SceneRenderer position={[0, 0, 1]} />
|
|
356
|
+
<ContactMarkers visible={showContacts} />
|
|
357
|
+
<Debug showJoints scale={0.5} />
|
|
358
|
+
```
|
|
359
|
+
|
|
258
360
|
### `<ContactMarkers />`
|
|
259
361
|
|
|
260
362
|
InstancedMesh showing MuJoCo contact points for debugging.
|
|
@@ -577,34 +679,7 @@ The full API object available via `ref` or `useMujocoSim().api`:
|
|
|
577
679
|
|
|
578
680
|
### Building Controllers
|
|
579
681
|
|
|
580
|
-
Controllers
|
|
581
|
-
|
|
582
|
-
```tsx
|
|
583
|
-
function FrankaController() {
|
|
584
|
-
useKeyboardTeleop({
|
|
585
|
-
bindings: { v: { actuator: 'gripper', toggle: [0, 255] } },
|
|
586
|
-
});
|
|
587
|
-
return null;
|
|
588
|
-
}
|
|
589
|
-
```
|
|
590
|
-
|
|
591
|
-
For custom control (IK solvers, velocity control), use `useBeforePhysicsStep`:
|
|
592
|
-
|
|
593
|
-
```tsx
|
|
594
|
-
function MyController() {
|
|
595
|
-
const keys = useRef<Record<string, boolean>>({});
|
|
596
|
-
// ... keyboard listeners ...
|
|
597
|
-
|
|
598
|
-
useBeforePhysicsStep((_model, data) => {
|
|
599
|
-
if (keys.current['KeyW']) data.ctrl[0] += 0.01;
|
|
600
|
-
});
|
|
601
|
-
return null;
|
|
602
|
-
}
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
For reusable controller plugins, use `createController<TConfig>()` to build typed components with config merging and metadata.
|
|
606
|
-
|
|
607
|
-
See [Building Controllers](https://mujoco-react.mintlify.app/guides/building-controllers) for config-driven patterns, IK gizmo coexistence, and multi-arm support.
|
|
682
|
+
See [Building Controllers](https://mujoco-react.mintlify.app/guides/building-controllers) for full patterns including config-driven controllers, IK gizmo coexistence, multi-arm support, and the `createController` factory.
|
|
608
683
|
|
|
609
684
|
### Graspable Objects
|
|
610
685
|
|
|
@@ -658,7 +733,7 @@ Features planned but not yet implemented:
|
|
|
658
733
|
| **URDF loading** | P2 | Load URDF models via MuJoCo's built-in URDF compiler |
|
|
659
734
|
| **XML mutation / recompile** | P1 | `addBody()`, `removeBody()`, `recompile()` for runtime XML editing |
|
|
660
735
|
| **Observation builder utilities** | P2 | Helpers for projected gravity, joint positions/velocities for RL |
|
|
661
|
-
| **Physics interpolation** | P1 | Smooth rendering between physics ticks for
|
|
736
|
+
| **Physics interpolation** | P1 | Smooth rendering between physics ticks for very high refresh displays |
|
|
662
737
|
| **Instanced geom rendering** | P2 | `<InstancedGeomRenderer />` for particle/granular sims |
|
|
663
738
|
| **Web Worker physics** | P2 | Run `mj_step` off main thread via SharedArrayBuffer |
|
|
664
739
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { CanvasProps } from '@react-three/fiber';
|
|
2
|
+
import { CanvasProps, ThreeElements } from '@react-three/fiber';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
|
|
@@ -240,12 +240,6 @@ interface SceneConfig {
|
|
|
240
240
|
homeJoints?: number[];
|
|
241
241
|
xmlPatches?: XmlPatch[];
|
|
242
242
|
onReset?: (model: MujocoModel, data: MujocoData) => void;
|
|
243
|
-
/** @deprecated Use IkController config.siteName instead. */
|
|
244
|
-
tcpSiteName?: string;
|
|
245
|
-
/** @deprecated Use your own gripper control logic instead. */
|
|
246
|
-
gripperActuatorName?: string;
|
|
247
|
-
/** @deprecated Use IkController config.numJoints instead. */
|
|
248
|
-
numArmJoints?: number;
|
|
249
243
|
}
|
|
250
244
|
interface IkConfig {
|
|
251
245
|
/** MuJoCo site name for IK target. */
|
|
@@ -270,7 +264,6 @@ interface PhysicsConfig {
|
|
|
270
264
|
substeps?: number;
|
|
271
265
|
paused?: boolean;
|
|
272
266
|
speed?: number;
|
|
273
|
-
interpolate?: boolean;
|
|
274
267
|
}
|
|
275
268
|
type IKSolveFn = (pos: THREE.Vector3, quat: THREE.Quaternion, currentQ: number[]) => number[] | null;
|
|
276
269
|
type PhysicsStepCallback = (model: MujocoModel, data: MujocoData) => void;
|
|
@@ -470,9 +463,6 @@ type MujocoCanvasProps = Omit<CanvasProps, 'onError'> & {
|
|
|
470
463
|
substeps?: number;
|
|
471
464
|
paused?: boolean;
|
|
472
465
|
speed?: number;
|
|
473
|
-
interpolate?: boolean;
|
|
474
|
-
gravityCompensation?: boolean;
|
|
475
|
-
mjcfLights?: boolean;
|
|
476
466
|
};
|
|
477
467
|
interface SitePositionResult {
|
|
478
468
|
position: React.RefObject<THREE.Vector3>;
|
|
@@ -524,6 +514,50 @@ declare function MujocoProvider({ wasmUrl, timeout, children, onError }: MujocoP
|
|
|
524
514
|
*/
|
|
525
515
|
declare const MujocoCanvas: react.ForwardRefExoticComponent<Omit<MujocoCanvasProps, "ref"> & react.RefAttributes<MujocoSimAPI>>;
|
|
526
516
|
|
|
517
|
+
interface MujocoPhysicsProps {
|
|
518
|
+
/** Scene/robot configuration. */
|
|
519
|
+
config: SceneConfig;
|
|
520
|
+
/** Fires when model is loaded and API is ready. */
|
|
521
|
+
onReady?: (api: MujocoSimAPI) => void;
|
|
522
|
+
/** Fires on scene load failure. */
|
|
523
|
+
onError?: (error: Error) => void;
|
|
524
|
+
/** Called each physics step. */
|
|
525
|
+
onStep?: (time: number) => void;
|
|
526
|
+
/** Called on body double-click selection. */
|
|
527
|
+
onSelection?: (bodyId: number, name: string) => void;
|
|
528
|
+
/** Override model gravity. */
|
|
529
|
+
gravity?: [number, number, number];
|
|
530
|
+
/** Override model.opt.timestep. */
|
|
531
|
+
timestep?: number;
|
|
532
|
+
/** mj_step calls per frame. */
|
|
533
|
+
substeps?: number;
|
|
534
|
+
/** Declarative pause. */
|
|
535
|
+
paused?: boolean;
|
|
536
|
+
/** Simulation speed multiplier. */
|
|
537
|
+
speed?: number;
|
|
538
|
+
children: React.ReactNode;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* MujocoPhysics — physics provider for use inside a user-owned R3F Canvas.
|
|
542
|
+
*
|
|
543
|
+
* This is the R3F-idiomatic alternative to MujocoCanvas. Instead of wrapping
|
|
544
|
+
* the Canvas, place this inside your own <Canvas>:
|
|
545
|
+
*
|
|
546
|
+
* ```tsx
|
|
547
|
+
* <MujocoProvider>
|
|
548
|
+
* <Canvas shadows camera={...}>
|
|
549
|
+
* <MujocoPhysics config={config} paused={paused}>
|
|
550
|
+
* <SceneRenderer />
|
|
551
|
+
* <OrbitControls />
|
|
552
|
+
* </MujocoPhysics>
|
|
553
|
+
* </Canvas>
|
|
554
|
+
* </MujocoProvider>
|
|
555
|
+
* ```
|
|
556
|
+
*
|
|
557
|
+
* Forward ref exposes MujocoSimAPI.
|
|
558
|
+
*/
|
|
559
|
+
declare const MujocoPhysics: react.ForwardRefExoticComponent<MujocoPhysicsProps & react.RefAttributes<MujocoSimAPI>>;
|
|
560
|
+
|
|
527
561
|
interface MujocoSimContextValue {
|
|
528
562
|
api: MujocoSimAPI;
|
|
529
563
|
mjModelRef: React.RefObject<MujocoModel | null>;
|
|
@@ -555,10 +589,9 @@ interface MujocoSimProviderProps {
|
|
|
555
589
|
substeps?: number;
|
|
556
590
|
paused?: boolean;
|
|
557
591
|
speed?: number;
|
|
558
|
-
interpolate?: boolean;
|
|
559
592
|
children: React.ReactNode;
|
|
560
593
|
}
|
|
561
|
-
declare function MujocoSimProvider({ mujoco, config, apiRef: externalApiRef, onReady, onError, onStep, onSelection, gravity, timestep, substeps, paused, speed,
|
|
594
|
+
declare function MujocoSimProvider({ mujoco, config, apiRef: externalApiRef, onReady, onError, onStep, onSelection, gravity, timestep, substeps, paused, speed, children, }: MujocoSimProviderProps): react_jsx_runtime.JSX.Element;
|
|
562
595
|
|
|
563
596
|
/**
|
|
564
597
|
* @license
|
|
@@ -604,8 +637,6 @@ declare function findTendonByName(mjModel: MujocoModel, name: string): number;
|
|
|
604
637
|
interface LoadResult {
|
|
605
638
|
mjModel: MujocoModel;
|
|
606
639
|
mjData: MujocoData;
|
|
607
|
-
siteId: number;
|
|
608
|
-
gripperId: number;
|
|
609
640
|
}
|
|
610
641
|
/**
|
|
611
642
|
* Config-driven scene loader — replaces the old RobotLoader + patchSingleRobot approach.
|
|
@@ -687,15 +718,11 @@ declare function useIk(options: {
|
|
|
687
718
|
optional: true;
|
|
688
719
|
}): IkContextValue | null;
|
|
689
720
|
|
|
690
|
-
/**
|
|
691
|
-
* @license
|
|
692
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
693
|
-
*/
|
|
694
721
|
/**
|
|
695
722
|
* SceneRenderer — creates and syncs MuJoCo body meshes every frame.
|
|
696
|
-
*
|
|
723
|
+
* Accepts standard R3F group props (position, rotation, scale, visible, etc.).
|
|
697
724
|
*/
|
|
698
|
-
declare function SceneRenderer(): react_jsx_runtime.JSX.Element;
|
|
725
|
+
declare function SceneRenderer(props: Omit<ThreeElements['group'], 'ref'>): react_jsx_runtime.JSX.Element;
|
|
699
726
|
|
|
700
727
|
/**
|
|
701
728
|
* IkGizmo — drei PivotControls that tracks a MuJoCo site.
|
|
@@ -711,15 +738,6 @@ declare function SceneRenderer(): react_jsx_runtime.JSX.Element;
|
|
|
711
738
|
*/
|
|
712
739
|
declare function IkGizmo({ siteName, scale, onDrag }: IkGizmoProps): react_jsx_runtime.JSX.Element | null;
|
|
713
740
|
|
|
714
|
-
/**
|
|
715
|
-
* @license
|
|
716
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
717
|
-
*
|
|
718
|
-
* ContactMarkers — instanced sphere visualization of MuJoCo contacts (spec 6.2)
|
|
719
|
-
*
|
|
720
|
-
* Fixed from original: reads data.ncon first, accesses contact via .get(i),
|
|
721
|
-
* limits to maxContacts to avoid WASM heap OOM.
|
|
722
|
-
*/
|
|
723
741
|
interface ContactMarkersProps {
|
|
724
742
|
/** Maximum contacts to render. Default: 100. */
|
|
725
743
|
maxContacts?: number;
|
|
@@ -730,7 +748,7 @@ interface ContactMarkersProps {
|
|
|
730
748
|
/** Show markers. Default: true. */
|
|
731
749
|
visible?: boolean;
|
|
732
750
|
}
|
|
733
|
-
declare function ContactMarkers({ maxContacts, radius, color, visible, }?: ContactMarkersProps): react_jsx_runtime.JSX.Element | null;
|
|
751
|
+
declare function ContactMarkers({ maxContacts, radius, color, visible, ...groupProps }?: ContactMarkersProps & Omit<ThreeElements['group'], 'ref' | 'visible'>): react_jsx_runtime.JSX.Element | null;
|
|
734
752
|
|
|
735
753
|
/**
|
|
736
754
|
* DragInteraction — Ctrl/Cmd+click-drag to apply spring forces to MuJoCo bodies.
|
|
@@ -745,7 +763,7 @@ declare function ContactMarkers({ maxContacts, radius, color, visible, }?: Conta
|
|
|
745
763
|
* Forces compose with useGravityCompensation — the provider zeros
|
|
746
764
|
* qfrc_applied each frame, then all consumers add to it.
|
|
747
765
|
*/
|
|
748
|
-
declare function DragInteraction({ stiffness, showArrow, }: DragInteractionProps): react_jsx_runtime.JSX.Element | null;
|
|
766
|
+
declare function DragInteraction({ stiffness, showArrow, ...groupProps }: DragInteractionProps & Omit<ThreeElements['group'], 'ref'>): react_jsx_runtime.JSX.Element | null;
|
|
749
767
|
|
|
750
768
|
/**
|
|
751
769
|
* @license
|
|
@@ -767,33 +785,15 @@ declare function SceneLights({ intensity }: SceneLightsProps): null;
|
|
|
767
785
|
* Declarative debug visualization component.
|
|
768
786
|
* Renders wireframe geoms, site markers, joint axes, contact forces, COM markers, etc.
|
|
769
787
|
*/
|
|
770
|
-
declare function Debug({ showGeoms, showSites, showJoints, showContacts, showCOM, showInertia, showTendons, }: DebugProps): react_jsx_runtime.JSX.Element | null;
|
|
788
|
+
declare function Debug({ showGeoms, showSites, showJoints, showContacts, showCOM, showInertia, showTendons, ...groupProps }: DebugProps & Omit<ThreeElements['group'], 'ref'>): react_jsx_runtime.JSX.Element | null;
|
|
771
789
|
|
|
772
|
-
|
|
773
|
-
* @license
|
|
774
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
775
|
-
*
|
|
776
|
-
* TendonRenderer — render tendons as tube geometries (spec 6.4)
|
|
777
|
-
*
|
|
778
|
-
* WASM fields used: model.ntendon, model.ten_wrapadr, model.ten_wrapnum
|
|
779
|
-
* data.wrap_xpos, data.ten_wrapadr (runtime)
|
|
780
|
-
*
|
|
781
|
-
* Note: ten_rgba and ten_width are NOT available in mujoco-js 0.0.7.
|
|
782
|
-
* Tendons use a default color and width.
|
|
783
|
-
*/
|
|
784
|
-
declare function TendonRenderer(): react_jsx_runtime.JSX.Element | null;
|
|
790
|
+
declare function TendonRenderer(props: Omit<ThreeElements['group'], 'ref'>): react_jsx_runtime.JSX.Element | null;
|
|
785
791
|
|
|
786
|
-
/**
|
|
787
|
-
* @license
|
|
788
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
789
|
-
*
|
|
790
|
-
* FlexRenderer — render deformable flex bodies (spec 6.4)
|
|
791
|
-
*/
|
|
792
792
|
/**
|
|
793
793
|
* Renders MuJoCo flex (deformable) bodies as dynamic meshes.
|
|
794
794
|
* Vertices are updated every frame from flexvert_xpos.
|
|
795
795
|
*/
|
|
796
|
-
declare function FlexRenderer(): react_jsx_runtime.JSX.Element | null;
|
|
796
|
+
declare function FlexRenderer(props: Omit<ThreeElements['group'], 'ref'>): react_jsx_runtime.JSX.Element | null;
|
|
797
797
|
|
|
798
798
|
/**
|
|
799
799
|
* @license
|
|
@@ -1160,4 +1160,4 @@ interface CameraAnimationAPI {
|
|
|
1160
1160
|
*/
|
|
1161
1161
|
declare function useCameraAnimation(): CameraAnimationAPI;
|
|
1162
1162
|
|
|
1163
|
-
export { type ActuatorInfo, type BodyInfo, type BodyStateResult, type CameraAnimationAPI, type ContactInfo, ContactListener, type ContactListenerProps, ContactMarkers, type ControllerComponent, type ControllerOptions, Debug, type DebugProps, DragInteraction, type DragInteractionProps, FlexRenderer, type GeomInfo, type IKSolveFn, type IkConfig, type IkContextValue, IkController, IkGizmo, type IkGizmoProps, type JointInfo, type JointStateResult, type KeyBinding, type KeyboardTeleopConfig, type ModelOptions, MujocoCanvas, type MujocoCanvasProps, type MujocoContact, type MujocoContactArray, type MujocoContextValue, type MujocoData, type MujocoModel, type MujocoModule, MujocoProvider, type MujocoSimAPI, MujocoSimProvider, type PhysicsConfig, type PhysicsStepCallback, type PolicyConfig, type RayHit, type SceneConfig, SceneLights, type SceneLightsProps, type SceneMarker, type SceneObject, SceneRenderer, SelectionHighlight, type SelectionHighlightProps, type SensorInfo, type SensorResult, type SiteInfo, type SitePositionResult, type StateSnapshot, TendonRenderer, type TrajectoryData, type TrajectoryFrame, TrajectoryPlayer, type TrajectoryPlayerProps, type XmlPatch, createController, findActuatorByName, findBodyByName, findGeomByName, findJointByName, findKeyframeByName, findSensorByName, findSiteByName, findTendonByName, getContact, getName, loadScene, useActuators, useAfterPhysicsStep, useBeforePhysicsStep, useBodyState, useCameraAnimation, useContactEvents, useContacts, useCtrl, useCtrlNoise, useGamepad, useGravityCompensation, useIk, useJointState, useKeyboardTeleop, useMujoco, useMujocoSim, usePolicy, useSceneLights, useSelectionHighlight, useSensor, useSensors, useSitePosition, useTrajectoryPlayer, useTrajectoryRecorder, useVideoRecorder };
|
|
1163
|
+
export { type ActuatorInfo, type BodyInfo, type BodyStateResult, type CameraAnimationAPI, type ContactInfo, ContactListener, type ContactListenerProps, ContactMarkers, type ControllerComponent, type ControllerOptions, Debug, type DebugProps, DragInteraction, type DragInteractionProps, FlexRenderer, type GeomInfo, type IKSolveFn, type IkConfig, type IkContextValue, IkController, IkGizmo, type IkGizmoProps, type JointInfo, type JointStateResult, type KeyBinding, type KeyboardTeleopConfig, type ModelOptions, MujocoCanvas, type MujocoCanvasProps, type MujocoContact, type MujocoContactArray, type MujocoContextValue, type MujocoData, type MujocoModel, type MujocoModule, MujocoPhysics, type MujocoPhysicsProps, MujocoProvider, type MujocoSimAPI, MujocoSimProvider, type PhysicsConfig, type PhysicsStepCallback, type PolicyConfig, type RayHit, type SceneConfig, SceneLights, type SceneLightsProps, type SceneMarker, type SceneObject, SceneRenderer, SelectionHighlight, type SelectionHighlightProps, type SensorInfo, type SensorResult, type SiteInfo, type SitePositionResult, type StateSnapshot, TendonRenderer, type TrajectoryData, type TrajectoryFrame, TrajectoryPlayer, type TrajectoryPlayerProps, type XmlPatch, createController, findActuatorByName, findBodyByName, findGeomByName, findJointByName, findKeyframeByName, findSensorByName, findSiteByName, findTendonByName, getContact, getName, loadScene, useActuators, useAfterPhysicsStep, useBeforePhysicsStep, useBodyState, useCameraAnimation, useContactEvents, useContacts, useCtrl, useCtrlNoise, useGamepad, useGravityCompensation, useIk, useJointState, useKeyboardTeleop, useMujoco, useMujocoSim, usePolicy, useSceneLights, useSelectionHighlight, useSensor, useSensors, useSitePosition, useTrajectoryPlayer, useTrajectoryRecorder, useVideoRecorder };
|