mujoco-react 9.5.0 → 9.6.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/dist/{chunk-6MOK6ZWB.js → chunk-4JHALVB2.js} +2 -2
- package/dist/chunk-4JHALVB2.js.map +1 -0
- package/dist/index.d.ts +16 -3
- package/dist/index.js +140 -4
- package/dist/index.js.map +1 -1
- package/dist/spark.d.ts +1 -1
- package/dist/spark.js +1 -1
- package/dist/{types-BDB9QT6Z.d.ts → types-C1rwH74Y.d.ts} +36 -1
- package/package.json +1 -1
- package/src/hooks/useIkController.ts +8 -1
- package/src/hooks/useKeyboardIkTarget.ts +170 -0
- package/src/index.ts +4 -0
- package/src/types.ts +50 -0
- package/dist/chunk-6MOK6ZWB.js.map +0 -1
package/dist/spark.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as _sparkjsdev_spark from '@sparkjsdev/spark';
|
|
3
|
-
import { n as SplatEnvironmentProps, q as PairedSplatEnvironmentConfig, S as SceneConfig, t as SplatEnvironmentReadiness, o as VisualScenarioConfig } from './types-
|
|
3
|
+
import { n as SplatEnvironmentProps, q as PairedSplatEnvironmentConfig, S as SceneConfig, t as SplatEnvironmentReadiness, o as VisualScenarioConfig } from './types-C1rwH74Y.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@react-three/fiber';
|
|
6
6
|
import 'three';
|
package/dist/spark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useSplatSceneConfig, useSplatEnvironment, SplatEnvironment, CAMERA_FRAME_CAPTURE_RENDER_USER_DATA_KEY } from './chunk-
|
|
1
|
+
import { useSplatSceneConfig, useSplatEnvironment, SplatEnvironment, CAMERA_FRAME_CAPTURE_RENDER_USER_DATA_KEY } from './chunk-4JHALVB2.js';
|
|
2
2
|
import { useThree } from '@react-three/fiber';
|
|
3
3
|
import { useMemo, useState, useEffect, useCallback, useRef } from 'react';
|
|
4
4
|
import * as THREE from 'three';
|
|
@@ -383,6 +383,14 @@ interface IkConfig {
|
|
|
383
383
|
ikSolveFn?: IKSolveFn;
|
|
384
384
|
/** DLS damping. Default: 0.01. */
|
|
385
385
|
damping?: number;
|
|
386
|
+
/** Position error weight for the built-in DLS solver. Default: 1. */
|
|
387
|
+
posWeight?: number;
|
|
388
|
+
/** Orientation error weight for the built-in DLS solver. Default: 0.3. */
|
|
389
|
+
rotWeight?: number;
|
|
390
|
+
/** Solver convergence tolerance. Default: 1e-3. */
|
|
391
|
+
tolerance?: number;
|
|
392
|
+
/** Finite-difference step used by the built-in DLS solver. Default: 1e-6. */
|
|
393
|
+
epsilon?: number;
|
|
386
394
|
/** Max solver iterations. Default: 50. */
|
|
387
395
|
maxIterations?: number;
|
|
388
396
|
}
|
|
@@ -659,6 +667,33 @@ interface IkGizmoDragInput {
|
|
|
659
667
|
position: THREE.Vector3;
|
|
660
668
|
quaternion: THREE.Quaternion;
|
|
661
669
|
}
|
|
670
|
+
type KeyboardIkTargetAction = 'x+' | 'x-' | 'y+' | 'y-' | 'z+' | 'z-' | 'pitch+' | 'pitch-' | 'yaw+' | 'yaw-' | 'roll+' | 'roll-';
|
|
671
|
+
interface KeyboardIkTargetBinding {
|
|
672
|
+
/** KeyboardEvent.code, e.g. `KeyW`, `ArrowUp`, `Space`. */
|
|
673
|
+
code: string;
|
|
674
|
+
action: KeyboardIkTargetAction;
|
|
675
|
+
/** Override translation speed in meters/second for this binding. */
|
|
676
|
+
translateSpeed?: number;
|
|
677
|
+
/** Override rotation speed in radians/second for this binding. */
|
|
678
|
+
rotateSpeed?: number;
|
|
679
|
+
}
|
|
680
|
+
interface KeyboardIkTargetConfig {
|
|
681
|
+
controller: IkContextValue | null;
|
|
682
|
+
bindings: KeyboardIkTargetBinding[];
|
|
683
|
+
enabled?: boolean;
|
|
684
|
+
/** Default translation speed in meters/second. Default: 0.25. */
|
|
685
|
+
translateSpeed?: number;
|
|
686
|
+
/** Default rotation speed in radians/second. Default: 1.0. */
|
|
687
|
+
rotateSpeed?: number;
|
|
688
|
+
/** Apply translation and rotation axes in world or current target space. Default: `world`. */
|
|
689
|
+
frame?: 'world' | 'target';
|
|
690
|
+
/** Enable IK while keys are active. Default: true. */
|
|
691
|
+
autoEnableIk?: boolean;
|
|
692
|
+
/** Sync target to current site when keyboard control starts. Default: true. */
|
|
693
|
+
syncOnStart?: boolean;
|
|
694
|
+
/** Prevent browser default behavior for bound keys. Default: true. */
|
|
695
|
+
preventDefault?: boolean;
|
|
696
|
+
}
|
|
662
697
|
interface DragInteractionProps {
|
|
663
698
|
stiffness?: number;
|
|
664
699
|
showArrow?: boolean;
|
|
@@ -1165,4 +1200,4 @@ interface JointStateResult {
|
|
|
1165
1200
|
velocity: React__default.RefObject<number | Float64Array>;
|
|
1166
1201
|
}
|
|
1167
1202
|
|
|
1168
|
-
export { type Bodies as $, type ActuatedJointInfo as A, type BodyProps as B, type ControlGroupInfo as C, type DragInteractionProps as D, type ScenarioLightingPreset as E, type SplatEnvironmentMetadataInput as F, type SplatEnvironmentMetadata as G, type SplatSceneInput as H, type IkConfig as I, type DebugProps as J, type GeomInfo as K, type ContactListenerProps as L, type MujocoContextValue as M, type ActuatorInfo as N, type ObservationConfig as O, type PhysicsStepCallback as P, type Sites as Q, type ReadyCallbackInput as R, type SceneConfig as S, type TrajectoryPlayerProps as T, type SitePositionResult as U, type VisualScenarioEffectsProps as V, type Sensors as W, type SensorHandle as X, type SensorInfo as Y, type Joints as Z, type JointStateResult as _, type MujocoCanvasProps as a,
|
|
1203
|
+
export { type Bodies as $, type ActuatedJointInfo as A, type BodyProps as B, type ControlGroupInfo as C, type DragInteractionProps as D, type ScenarioLightingPreset as E, type SplatEnvironmentMetadataInput as F, type SplatEnvironmentMetadata as G, type SplatSceneInput as H, type IkConfig as I, type DebugProps as J, type GeomInfo as K, type ContactListenerProps as L, type MujocoContextValue as M, type ActuatorInfo as N, type ObservationConfig as O, type PhysicsStepCallback as P, type Sites as Q, type ReadyCallbackInput as R, type SceneConfig as S, type TrajectoryPlayerProps as T, type SitePositionResult as U, type VisualScenarioEffectsProps as V, type Sensors as W, type SensorHandle as X, type SensorInfo as Y, type Joints as Z, type JointStateResult as _, type MujocoCanvasProps as a, type ResolvedScenarioCameraConfig as a$, type BodyStateResult as a0, type Actuators as a1, type CtrlHandle as a2, type ContactInfo as a3, type KeyboardTeleopConfig as a4, type KeyboardIkTargetConfig as a5, type PolicyConfig as a6, type PolicyVector as a7, type ObservationHandle as a8, type TrajectoryInput as a9, type FrameCaptureStatus as aA, type FrameCaptureTarget as aB, type FrameCaptureTargetRef as aC, type Geoms as aD, type IKSolveFn as aE, type IkGizmoDragInput as aF, type IkSolveInput as aG, type JointInfo as aH, type KeyBinding as aI, type KeyboardIkTargetAction as aJ, type KeyboardIkTargetBinding as aK, type Keyframes as aL, type ModelOptions as aM, type MujocoContact as aN, type MujocoContactArray as aO, type MujocoFrameCaptureOptions as aP, type ObservationLayoutItem as aQ, type ObservationOutput as aR, type PhysicsConfig as aS, type PhysicsStepInput as aT, type PolicyActionInput as aU, type PolicyInferenceInput as aV, type PolicyObservationInput as aW, type RayHit as aX, type Register as aY, type RegisteredRobotMap as aZ, type ResetCallbackInput as a_, type TrajectoryStateChangeInput as aa, type PlaybackState as ab, type TrajectoryFrame as ac, type FrameCaptureOptions as ad, type FrameCaptureResult as ae, type FrameCaptureBlobResult as af, type FrameCaptureAPI as ag, type CameraFrameCaptureOptions as ah, type CameraFrameCaptureAPI as ai, type CameraFrameSequenceRecorderAPI as aj, type Cameras as ak, type CameraFrameSequenceCamera as al, type CameraFrameCaptureSource as am, type CameraFrameSequenceOptions as an, type CameraFrameSequenceResult as ao, type CameraFrameCaptureResult as ap, type CameraFrameCaptureBlobResult as aq, type BodyInfo as ar, type CameraFrameCaptureQuaternion as as, type CameraFrameCaptureVector3 as at, type CameraFrameSequenceCameraSummary as au, type CameraFrameSequenceFrame as av, type CameraFrameSequenceSampleInput as aw, type CameraFrameSequenceStepInput as ax, type CameraInfo as ay, type ControlJointInfo as az, type MujocoSimAPI as b, type ResolvedScenarioMaterialConfig as b0, type ResourceSelector as b1, RobotActuators as b2, RobotBodies as b3, RobotCameras as b4, RobotGeoms as b5, RobotJoints as b6, RobotKeyframes as b7, type RobotResource as b8, RobotResources as b9, RobotSensors as ba, RobotSites as bb, type Robots as bc, type ScenarioCameraConfig as bd, type ScenarioMaterialConfig as be, type SceneMarker as bf, type SceneObject as bg, type SensorResult as bh, type SiteInfo as bi, type SplatAssetConfig as bj, type SplatScenarioConfig as bk, type StateSnapshot as bl, type TrajectoryData as bm, type TrajectoryFrameCallbackInput as bn, type VisualScenarioMaterialFilterInput as bo, type XmlPatch as bp, getContact as bq, registerRobotResources as br, type StepCallbackInput as c, type SelectionCallbackInput as d, type MujocoModule as e, type MujocoModel as f, type MujocoData as g, type ControlGroupSelector as h, type ObservationResult as i, type IkContextValue as j, type IkGizmoProps as k, type SceneLightsProps as l, type ScenarioLightingProps as m, type SplatEnvironmentProps as n, type VisualScenarioConfig as o, type SplatRendererKind as p, type PairedSplatEnvironmentConfig as q, type SplatFormat as r, type SplatCollisionProxyConfig as s, type SplatEnvironmentReadiness as t, type SplatCollisionPrimitive as u, SplatEnvironmentReadinessStatus as v, type SplatSceneConfigInput as w, type SplatSceneConfigState as x, type VisualScenarioExecutionContextInput as y, type VisualScenarioExecutionContext as z };
|
package/package.json
CHANGED
|
@@ -94,7 +94,14 @@ export const useIkController = createControllerHook<IkConfig, IkContextValue>(
|
|
|
94
94
|
return genericIkRef.current.solve(
|
|
95
95
|
model, data, siteIdRef.current, controlGroup.qposAdr,
|
|
96
96
|
position, quaternion, currentQ,
|
|
97
|
-
{
|
|
97
|
+
{
|
|
98
|
+
damping: config.damping,
|
|
99
|
+
epsilon: config.epsilon,
|
|
100
|
+
maxIterations: config.maxIterations,
|
|
101
|
+
posWeight: config.posWeight,
|
|
102
|
+
rotWeight: config.rotWeight,
|
|
103
|
+
tolerance: config.tolerance,
|
|
104
|
+
},
|
|
98
105
|
);
|
|
99
106
|
},
|
|
100
107
|
[config, mjModelRef, mjDataRef],
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useFrame } from '@react-three/fiber';
|
|
7
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
8
|
+
import * as THREE from 'three';
|
|
9
|
+
import type { KeyboardIkTargetAction, KeyboardIkTargetBinding, KeyboardIkTargetConfig } from '../types';
|
|
10
|
+
|
|
11
|
+
const DEFAULT_TRANSLATE_SPEED = 0.25;
|
|
12
|
+
const DEFAULT_ROTATE_SPEED = 1.0;
|
|
13
|
+
|
|
14
|
+
const _translation = new THREE.Vector3();
|
|
15
|
+
const _axis = new THREE.Vector3();
|
|
16
|
+
const _quat = new THREE.Quaternion();
|
|
17
|
+
|
|
18
|
+
function actionSign(action: KeyboardIkTargetAction): 1 | -1 {
|
|
19
|
+
return action.endsWith('+') ? 1 : -1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function actionBase(action: KeyboardIkTargetAction) {
|
|
23
|
+
return action.slice(0, -1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function applyRotation(
|
|
27
|
+
target: THREE.Object3D,
|
|
28
|
+
action: KeyboardIkTargetAction,
|
|
29
|
+
amount: number,
|
|
30
|
+
frame: 'world' | 'target',
|
|
31
|
+
) {
|
|
32
|
+
const base = actionBase(action);
|
|
33
|
+
if (base === 'pitch') {
|
|
34
|
+
_axis.set(1, 0, 0);
|
|
35
|
+
} else if (base === 'yaw') {
|
|
36
|
+
_axis.set(0, 1, 0);
|
|
37
|
+
} else if (base === 'roll') {
|
|
38
|
+
_axis.set(0, 0, 1);
|
|
39
|
+
} else {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
_quat.setFromAxisAngle(_axis, amount);
|
|
44
|
+
if (frame === 'target') {
|
|
45
|
+
target.quaternion.multiply(_quat);
|
|
46
|
+
} else {
|
|
47
|
+
target.quaternion.premultiply(_quat);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function addTranslation(action: KeyboardIkTargetAction, amount: number) {
|
|
52
|
+
switch (action) {
|
|
53
|
+
case 'x+':
|
|
54
|
+
_translation.x += amount;
|
|
55
|
+
break;
|
|
56
|
+
case 'x-':
|
|
57
|
+
_translation.x -= amount;
|
|
58
|
+
break;
|
|
59
|
+
case 'y+':
|
|
60
|
+
_translation.y += amount;
|
|
61
|
+
break;
|
|
62
|
+
case 'y-':
|
|
63
|
+
_translation.y -= amount;
|
|
64
|
+
break;
|
|
65
|
+
case 'z+':
|
|
66
|
+
_translation.z += amount;
|
|
67
|
+
break;
|
|
68
|
+
case 'z-':
|
|
69
|
+
_translation.z -= amount;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Moves an existing IK target from keyboard input.
|
|
76
|
+
*
|
|
77
|
+
* This hook is intentionally robot-agnostic: it only edits the target owned by
|
|
78
|
+
* `useIkController`, then lets the normal IK solver write robot controls.
|
|
79
|
+
*/
|
|
80
|
+
export function useKeyboardIkTarget(config: KeyboardIkTargetConfig | null) {
|
|
81
|
+
const pressedRef = useRef(new Set<string>());
|
|
82
|
+
const wasActiveRef = useRef(false);
|
|
83
|
+
const configRef = useRef(config);
|
|
84
|
+
configRef.current = config;
|
|
85
|
+
|
|
86
|
+
const boundCodes = useMemo(() => {
|
|
87
|
+
return new Set((config?.bindings ?? []).map((binding) => binding.code));
|
|
88
|
+
}, [config?.bindings]);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
92
|
+
const current = configRef.current;
|
|
93
|
+
if (!current || current.enabled === false || !boundCodes.has(event.code)) return;
|
|
94
|
+
if (current.preventDefault !== false) event.preventDefault();
|
|
95
|
+
pressedRef.current.add(event.code);
|
|
96
|
+
};
|
|
97
|
+
const onKeyUp = (event: KeyboardEvent) => {
|
|
98
|
+
const current = configRef.current;
|
|
99
|
+
if (boundCodes.has(event.code) && current?.preventDefault !== false) {
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
}
|
|
102
|
+
pressedRef.current.delete(event.code);
|
|
103
|
+
};
|
|
104
|
+
const onBlur = () => {
|
|
105
|
+
pressedRef.current.clear();
|
|
106
|
+
wasActiveRef.current = false;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
window.addEventListener('keydown', onKeyDown);
|
|
110
|
+
window.addEventListener('keyup', onKeyUp);
|
|
111
|
+
window.addEventListener('blur', onBlur);
|
|
112
|
+
|
|
113
|
+
return () => {
|
|
114
|
+
window.removeEventListener('keydown', onKeyDown);
|
|
115
|
+
window.removeEventListener('keyup', onKeyUp);
|
|
116
|
+
window.removeEventListener('blur', onBlur);
|
|
117
|
+
};
|
|
118
|
+
}, [boundCodes]);
|
|
119
|
+
|
|
120
|
+
useFrame((_state, delta) => {
|
|
121
|
+
const current = configRef.current;
|
|
122
|
+
const controller = current?.controller;
|
|
123
|
+
if (!current || current.enabled === false || !controller) {
|
|
124
|
+
wasActiveRef.current = false;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const activeBindings: KeyboardIkTargetBinding[] = [];
|
|
129
|
+
for (const binding of current.bindings) {
|
|
130
|
+
if (pressedRef.current.has(binding.code)) activeBindings.push(binding);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (activeBindings.length === 0) {
|
|
134
|
+
wasActiveRef.current = false;
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (!wasActiveRef.current) {
|
|
139
|
+
if (current.syncOnStart !== false) controller.syncTargetToSite();
|
|
140
|
+
if (current.autoEnableIk !== false && !controller.ikEnabledRef.current) {
|
|
141
|
+
controller.setIkEnabled(true);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
wasActiveRef.current = true;
|
|
145
|
+
|
|
146
|
+
const target = controller.ikTargetRef.current;
|
|
147
|
+
if (!target) return;
|
|
148
|
+
|
|
149
|
+
const frame = current.frame ?? 'world';
|
|
150
|
+
_translation.set(0, 0, 0);
|
|
151
|
+
|
|
152
|
+
for (const binding of activeBindings) {
|
|
153
|
+
const translateSpeed = binding.translateSpeed ?? current.translateSpeed ?? DEFAULT_TRANSLATE_SPEED;
|
|
154
|
+
const rotateSpeed = binding.rotateSpeed ?? current.rotateSpeed ?? DEFAULT_ROTATE_SPEED;
|
|
155
|
+
const amount = actionSign(binding.action) * delta;
|
|
156
|
+
const base = actionBase(binding.action);
|
|
157
|
+
|
|
158
|
+
if (base === 'x' || base === 'y' || base === 'z') {
|
|
159
|
+
addTranslation(binding.action, translateSpeed * delta);
|
|
160
|
+
} else {
|
|
161
|
+
applyRotation(target, binding.action, rotateSpeed * amount, frame);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (_translation.lengthSq() > 0) {
|
|
166
|
+
if (frame === 'target') _translation.applyQuaternion(target.quaternion);
|
|
167
|
+
target.position.add(_translation);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -91,6 +91,7 @@ export { useBodyState } from './hooks/useBodyState';
|
|
|
91
91
|
export { useCtrl } from './hooks/useCtrl';
|
|
92
92
|
export { useContacts, useContactEvents } from './hooks/useContacts';
|
|
93
93
|
export { useKeyboardTeleop } from './hooks/useKeyboardTeleop';
|
|
94
|
+
export { useKeyboardIkTarget } from './hooks/useKeyboardIkTarget';
|
|
94
95
|
export { usePolicy } from './hooks/usePolicy';
|
|
95
96
|
export { useObservation } from './hooks/useObservation';
|
|
96
97
|
export { useTrajectoryPlayer } from './hooks/useTrajectoryPlayer';
|
|
@@ -211,6 +212,9 @@ export type {
|
|
|
211
212
|
// Keyboard teleop
|
|
212
213
|
KeyBinding,
|
|
213
214
|
KeyboardTeleopConfig,
|
|
215
|
+
KeyboardIkTargetAction,
|
|
216
|
+
KeyboardIkTargetBinding,
|
|
217
|
+
KeyboardIkTargetConfig,
|
|
214
218
|
// Policy
|
|
215
219
|
PolicyConfig,
|
|
216
220
|
PolicyVector,
|
package/src/types.ts
CHANGED
|
@@ -516,6 +516,14 @@ export interface IkConfig {
|
|
|
516
516
|
ikSolveFn?: IKSolveFn;
|
|
517
517
|
/** DLS damping. Default: 0.01. */
|
|
518
518
|
damping?: number;
|
|
519
|
+
/** Position error weight for the built-in DLS solver. Default: 1. */
|
|
520
|
+
posWeight?: number;
|
|
521
|
+
/** Orientation error weight for the built-in DLS solver. Default: 0.3. */
|
|
522
|
+
rotWeight?: number;
|
|
523
|
+
/** Solver convergence tolerance. Default: 1e-3. */
|
|
524
|
+
tolerance?: number;
|
|
525
|
+
/** Finite-difference step used by the built-in DLS solver. Default: 1e-6. */
|
|
526
|
+
epsilon?: number;
|
|
519
527
|
/** Max solver iterations. Default: 50. */
|
|
520
528
|
maxIterations?: number;
|
|
521
529
|
}
|
|
@@ -864,6 +872,48 @@ export interface IkGizmoDragInput {
|
|
|
864
872
|
quaternion: THREE.Quaternion;
|
|
865
873
|
}
|
|
866
874
|
|
|
875
|
+
export type KeyboardIkTargetAction =
|
|
876
|
+
| 'x+'
|
|
877
|
+
| 'x-'
|
|
878
|
+
| 'y+'
|
|
879
|
+
| 'y-'
|
|
880
|
+
| 'z+'
|
|
881
|
+
| 'z-'
|
|
882
|
+
| 'pitch+'
|
|
883
|
+
| 'pitch-'
|
|
884
|
+
| 'yaw+'
|
|
885
|
+
| 'yaw-'
|
|
886
|
+
| 'roll+'
|
|
887
|
+
| 'roll-';
|
|
888
|
+
|
|
889
|
+
export interface KeyboardIkTargetBinding {
|
|
890
|
+
/** KeyboardEvent.code, e.g. `KeyW`, `ArrowUp`, `Space`. */
|
|
891
|
+
code: string;
|
|
892
|
+
action: KeyboardIkTargetAction;
|
|
893
|
+
/** Override translation speed in meters/second for this binding. */
|
|
894
|
+
translateSpeed?: number;
|
|
895
|
+
/** Override rotation speed in radians/second for this binding. */
|
|
896
|
+
rotateSpeed?: number;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
export interface KeyboardIkTargetConfig {
|
|
900
|
+
controller: IkContextValue | null;
|
|
901
|
+
bindings: KeyboardIkTargetBinding[];
|
|
902
|
+
enabled?: boolean;
|
|
903
|
+
/** Default translation speed in meters/second. Default: 0.25. */
|
|
904
|
+
translateSpeed?: number;
|
|
905
|
+
/** Default rotation speed in radians/second. Default: 1.0. */
|
|
906
|
+
rotateSpeed?: number;
|
|
907
|
+
/** Apply translation and rotation axes in world or current target space. Default: `world`. */
|
|
908
|
+
frame?: 'world' | 'target';
|
|
909
|
+
/** Enable IK while keys are active. Default: true. */
|
|
910
|
+
autoEnableIk?: boolean;
|
|
911
|
+
/** Sync target to current site when keyboard control starts. Default: true. */
|
|
912
|
+
syncOnStart?: boolean;
|
|
913
|
+
/** Prevent browser default behavior for bound keys. Default: true. */
|
|
914
|
+
preventDefault?: boolean;
|
|
915
|
+
}
|
|
916
|
+
|
|
867
917
|
export interface DragInteractionProps {
|
|
868
918
|
stiffness?: number;
|
|
869
919
|
showArrow?: boolean;
|