three-usd-robot 0.13.0 → 0.13.1
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-GRJGPHLW.js → chunk-5C3VTA56.js} +3 -3
- package/dist/{chunk-GRJGPHLW.js.map → chunk-5C3VTA56.js.map} +1 -1
- package/dist/{chunk-FUVHAORT.js → chunk-J6ZQWQ2C.js} +50 -21
- package/dist/chunk-J6ZQWQ2C.js.map +1 -0
- package/dist/{chunk-5ZPHZ5ZH.js → chunk-ZHUNBTUV.js} +3 -3
- package/dist/{chunk-5ZPHZ5ZH.js.map → chunk-ZHUNBTUV.js.map} +1 -1
- package/dist/core.js +2 -2
- package/dist/index.js +5 -5
- package/dist/react.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-FUVHAORT.js.map +0 -1
|
@@ -156,27 +156,35 @@ function getJointDrive(prim, kind) {
|
|
|
156
156
|
function getJointStatePosition(prim, kind) {
|
|
157
157
|
return readNumber(prim, `state:${kind}:physics:position`);
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function physxMimicDof(type, axis) {
|
|
160
|
+
if (type === "fixed") return void 0;
|
|
161
|
+
return `${type === "prismatic" ? "trans" : "rot"}${axis}`;
|
|
162
|
+
}
|
|
163
|
+
function getJointMimic(prim, dof) {
|
|
160
164
|
if (prim.HasAPI(NEWTON_MIMIC_API)) {
|
|
161
165
|
if (prim.GetAttribute("newton:mimicEnabled").Get() === false) return void 0;
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
166
|
+
const referencePath2 = prim.GetRelationship("newton:mimicJoint").GetTargets()[0];
|
|
167
|
+
if (referencePath2 === void 0) return void 0;
|
|
164
168
|
return {
|
|
165
|
-
referencePath,
|
|
169
|
+
referencePath: referencePath2,
|
|
166
170
|
multiplier: readNumber(prim, "newton:mimicCoef1") ?? 1,
|
|
167
171
|
offset: readNumber(prim, "newton:mimicCoef0") ?? 0
|
|
168
172
|
};
|
|
169
173
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
if (dof === void 0) return void 0;
|
|
175
|
+
const referencePath = prim.GetRelationship(`physxMimicJoint:${dof}:referenceJoint`).GetTargets()[0];
|
|
176
|
+
if (referencePath === void 0) return void 0;
|
|
177
|
+
const gearing = readNumber(prim, `physxMimicJoint:${dof}:gearing`) ?? 1;
|
|
178
|
+
const offset = readNumber(prim, `physxMimicJoint:${dof}:offset`) ?? 0;
|
|
179
|
+
const referenceDof = prim.GetAttribute(`physxMimicJoint:${dof}:referenceJointAxis`).Get();
|
|
180
|
+
return {
|
|
181
|
+
referencePath,
|
|
182
|
+
multiplier: -gearing,
|
|
183
|
+
offset: -offset,
|
|
184
|
+
...typeof referenceDof === "string" ? { referenceDof } : {}
|
|
185
|
+
};
|
|
178
186
|
}
|
|
179
|
-
function
|
|
187
|
+
function getPhysxMimicDofs(prim) {
|
|
180
188
|
const out = /* @__PURE__ */ new Set();
|
|
181
189
|
for (const schema of prim.GetAppliedSchemas()) {
|
|
182
190
|
if (schema.startsWith(`${PHYSX_MIMIC_API}:`)) out.add(schema.slice(PHYSX_MIMIC_API.length + 1));
|
|
@@ -578,16 +586,37 @@ function buildJoint(prim, linkKeyByPath, jointKeyByPath, warn) {
|
|
|
578
586
|
});
|
|
579
587
|
joint.valueSamples = { times, values };
|
|
580
588
|
}
|
|
581
|
-
const
|
|
589
|
+
const dof = physxMimicDof(type, joint.axis);
|
|
590
|
+
const mimic = getJointMimic(prim, dof);
|
|
582
591
|
if (mimic) {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
592
|
+
const leaderDof = jointDof(prim, mimic.referencePath);
|
|
593
|
+
if (mimic.referenceDof !== void 0 && leaderDof !== void 0 && mimic.referenceDof !== leaderDof) {
|
|
594
|
+
warn(
|
|
595
|
+
`${path}: mimic reads "${mimic.referencePath}" on \`${mimic.referenceDof}\`, which is not the dof it moves about (\`${leaderDof}\`); ignoring`
|
|
596
|
+
);
|
|
597
|
+
} else {
|
|
598
|
+
joint.mimic = {
|
|
599
|
+
joint: jointKeyByPath.get(mimic.referencePath) ?? mimic.referencePath,
|
|
600
|
+
multiplier: mimic.multiplier,
|
|
601
|
+
offset: jointValueToSI(angular, mimic.offset)
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
} else if (dof !== void 0) {
|
|
605
|
+
const authored = getPhysxMimicDofs(prim).filter((d) => d !== dof);
|
|
606
|
+
if (authored.length > 0) {
|
|
607
|
+
warn(
|
|
608
|
+
`${path}: mimic authored on \`${authored.join("`, `")}\` but the joint moves about \`${dof}\`; ignoring`
|
|
609
|
+
);
|
|
610
|
+
}
|
|
588
611
|
}
|
|
589
612
|
return joint;
|
|
590
613
|
}
|
|
614
|
+
function jointDof(from, path) {
|
|
615
|
+
const prim = from.GetStage().GetPrimAtPath(path);
|
|
616
|
+
if (!prim) return void 0;
|
|
617
|
+
const type = getJointType(prim);
|
|
618
|
+
return type ? physxMimicDof(type, getJointAxis(prim)) : void 0;
|
|
619
|
+
}
|
|
591
620
|
function dropInvalidMimics(joints, warn) {
|
|
592
621
|
for (const [key, joint] of Object.entries(joints)) {
|
|
593
622
|
const mimic = joint.mimic;
|
|
@@ -3409,5 +3438,5 @@ function openUsdz(bytes) {
|
|
|
3409
3438
|
}
|
|
3410
3439
|
|
|
3411
3440
|
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, Layer, MASS_API, MESH_COLLISION_API, NEWTON_MIMIC_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, collectMdlAssetPaths, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, getMaterialSubsets, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMesh, isNonVisualPurpose, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, jointValueFromSI, jointValueToSI, loadMdlModules, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, toBytes, tokenize };
|
|
3412
|
-
//# sourceMappingURL=chunk-
|
|
3413
|
-
//# sourceMappingURL=chunk-
|
|
3441
|
+
//# sourceMappingURL=chunk-J6ZQWQ2C.js.map
|
|
3442
|
+
//# sourceMappingURL=chunk-J6ZQWQ2C.js.map
|