@khr3/core 0.2.10 → 0.2.12
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 +8 -0
- package/dist/KhrAssembly.d.ts +44 -8
- package/dist/KhrCollider.d.ts +25 -7
- package/dist/clone.d.ts +45 -0
- package/dist/decoders.d.ts +30 -0
- package/dist/{khrExporter.d.ts → exporter.d.ts} +2 -2
- package/dist/{khrGlb.d.ts → glb.d.ts} +4 -3
- package/dist/index.d.ts +10 -9
- package/dist/index.js +1087 -926
- package/dist/index.js.map +1 -1
- package/dist/inertia.d.ts +41 -0
- package/dist/joints-5IgWDD2w.js +865 -0
- package/dist/joints-5IgWDD2w.js.map +1 -0
- package/dist/{jointDynamics.d.ts → joints.d.ts} +10 -7
- package/dist/loader.d.ts +9 -0
- package/dist/types.d.ts +284 -0
- package/dist/useKhrGlb.d.ts +6 -1
- package/dist/vehicle.d.ts +22 -2
- package/dist/vehicle.js +617 -665
- package/dist/vehicle.js.map +1 -1
- package/dist/vehicleJoints.d.ts +50 -0
- package/dist/wheelLoads.d.ts +5 -4
- package/package.json +4 -16
- package/dist/AssemblyRootBody.d.ts +0 -16
- package/dist/BundleSceneHost.d.ts +0 -23
- package/dist/KhrVehicle.d.ts +0 -20
- package/dist/assemblyPlan.d.ts +0 -61
- package/dist/curves.d.ts +0 -378
- package/dist/curves.js +0 -542
- package/dist/curves.js.map +0 -1
- package/dist/khrBundleFinalize.d.ts +0 -15
- package/dist/khrClone.d.ts +0 -14
- package/dist/khrConfigTypes.d.ts +0 -62
- package/dist/khrExportEncoders.d.ts +0 -8
- package/dist/khrExtras.d.ts +0 -22
- package/dist/khrInertia.d.ts +0 -18
- package/dist/khrJointParser.d.ts +0 -3
- package/dist/khrLoader.d.ts +0 -7
- package/dist/khrMassProps.d.ts +0 -16
- package/dist/khrParsers.d.ts +0 -10
- package/dist/khrPlugin.d.ts +0 -8
- package/dist/khrPluginHelpers.d.ts +0 -26
- package/dist/khrRotorDecoders.d.ts +0 -4
- package/dist/khrShapeParser.d.ts +0 -8
- package/dist/khrTypes.d.ts +0 -141
- package/dist/khrVehicleChassis.d.ts +0 -20
- package/dist/khrVehicleJointHelpers.d.ts +0 -37
- package/dist/khrVehicleJoints.d.ts +0 -30
- package/dist/khrVehicleRotors.d.ts +0 -22
- package/dist/khrVehicleSlots.d.ts +0 -41
- package/dist/khrVehicleTypes.d.ts +0 -52
- package/dist/pacejka.d.ts +0 -22
- package/dist/physicsEcs-Bi0ikONC.js +0 -1156
- package/dist/physicsEcs-Bi0ikONC.js.map +0 -1
- package/dist/physicsEcs.d.ts +0 -25
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import type { RapierRigidBody } from "@react-three/rapier";
|
|
3
|
+
import { type KhrBodySpec, type KhrColliderShape } from "./types.js";
|
|
4
|
+
export type Vec3Tuple = [number, number, number];
|
|
5
|
+
export type QuatTuple = [number, number, number, number];
|
|
6
|
+
export interface RapierBodyMassTarget {
|
|
7
|
+
readonly mass: number;
|
|
8
|
+
readonly com: Vec3Tuple;
|
|
9
|
+
readonly hasExplicitCom: boolean;
|
|
10
|
+
readonly inertiaDiagonal: Vec3Tuple;
|
|
11
|
+
readonly inertiaFrame: QuatTuple;
|
|
12
|
+
readonly hasExplicitInertia: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function assertUnitScale(scale: unknown, owner: string): void;
|
|
15
|
+
export declare function readFiniteVec3(val: unknown, fieldLabel: string): Vec3Tuple;
|
|
16
|
+
export declare function readUnitQuat(val: unknown, fieldLabel: string): QuatTuple;
|
|
17
|
+
export declare function assertIdentityWorldScale(obj: THREE.Object3D, nodeName: string): void;
|
|
18
|
+
export declare function assertSceneIdentityWorldScale(root: THREE.Object3D): void;
|
|
19
|
+
export declare function computeRelativePose(ownerObj: THREE.Object3D, childObj: THREE.Object3D): {
|
|
20
|
+
localPosition: Vec3Tuple;
|
|
21
|
+
localQuaternion: QuatTuple;
|
|
22
|
+
};
|
|
23
|
+
export declare function extractMeshColliderShape(targetObj: THREE.Object3D, meshNodeName: string, convexHull: boolean): KhrColliderShape;
|
|
24
|
+
export declare function bodyPoseMatrix(body: KhrBodySpec, target?: THREE.Matrix4): THREE.Matrix4;
|
|
25
|
+
export declare function computeAssemblyMassAndCom(bodies: readonly KhrBodySpec[]): {
|
|
26
|
+
totalDynamicMass: number;
|
|
27
|
+
centerOfMass: Vec3Tuple;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Builds a `RigidBody`-local mass specification from a `KhrBodySpec`.
|
|
31
|
+
* When `hasExplicitInertia` is false, Rapier WASM (`parry3d`) computes exact volume, CoM,
|
|
32
|
+
* parallel-axis tensor, and principal inertia directly from the attached colliders.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildBodyMassTarget(body: KhrBodySpec, bodyRotInRigidBody?: readonly [number, number, number, number], bodyOffsetInRigidBody?: readonly [number, number, number]): RapierBodyMassTarget | null;
|
|
35
|
+
/**
|
|
36
|
+
* Applies `KHR_physics_rigid_bodies` mass properties to a live Rapier WASM `RigidBody`:
|
|
37
|
+
* - Explicit `motion.inertiaDiagonal`: passes authored `{ mass, com, inertiaDiagonal, inertiaFrame }` directly to Rapier.
|
|
38
|
+
* - Omitted `motion.inertiaDiagonal`: delegates volume, CoM, parallel-axis lumping, and Jacobi principal-axis inertia
|
|
39
|
+
* to Rapier's Rust `parry3d` engine across all attached colliders, preserving explicit `motion.centerOfMass` if authored.
|
|
40
|
+
*/
|
|
41
|
+
export declare function applyRapierBodyMass(rb: RapierRigidBody, target: RapierBodyMassTarget | null): void;
|