Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
usd_skeleton_io.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
9
12#include "momentum/common/log.h"
14
15#include <pxr/base/tf/staticTokens.h>
16
17#include <pxr/base/gf/matrix4d.h>
18#include <pxr/base/gf/quatf.h>
19#include <pxr/base/gf/vec2f.h>
20#include <pxr/base/gf/vec3f.h>
21#include <pxr/base/gf/vec3i.h>
22#include <pxr/base/vt/array.h>
23#include <pxr/usd/sdf/valueTypeName.h>
24#include <pxr/usd/usd/primRange.h>
25#include <pxr/usd/usdGeom/scope.h>
26#include <pxr/usd/usdGeom/xform.h>
27#include <pxr/usd/usdSkel/cache.h>
28#include <pxr/usd/usdSkel/skeletonQuery.h>
29
30#include <cctype>
31
32PXR_NAMESPACE_USING_DIRECTIVE
33
35 _tokens,
36 (Collision)(Locators)((momentumType, "momentum:type"))((momentumParent, "momentum:parent"))(
37 (momentumLength, "momentum:length"))((momentumRadius, "momentum:radius"))(
38 (momentumRadii, "momentum:radii"))((momentumHalfExtents, "momentum:halfExtents"))(
39 (momentumTranslation, "momentum:translation"))((momentumRotation, "momentum:rotation"))(
40 (momentumName, "momentum:name"))((momentumOffset, "momentum:offset"))(
41 (momentumWeight, "momentum:weight"))((momentumLocked, "momentum:locked"))(
42 (momentumLimitOrigin,
43 "momentum:limitOrigin"))((momentumLimitWeight, "momentum:limitWeight"))(
44 (momentumAttachedToSkin,
45 "momentum:attachedToSkin"))((momentumSkinOffset, "momentum:skinOffset")));
46
47namespace momentum {
48
49namespace {
50
51Eigen::Matrix4f toEigenMatrix4f(const GfMatrix4d& gfMatrix) {
52 return Eigen::Map<const Eigen::Matrix4d>(gfMatrix.GetArray()).cast<float>();
53}
54
55GfMatrix4d toGfMatrix4d(const Eigen::Matrix4f& eigenMatrix) {
56 GfMatrix4d gfMatrix{};
57 Eigen::Map<Eigen::Matrix4d>(gfMatrix.GetArray()) = eigenMatrix.cast<double>();
58 return gfMatrix;
59}
60
61// Build a local-space transform matrix from a joint's preRotation and translationOffset.
62Eigen::Matrix4f jointToLocalTransform(const Joint& joint) {
63 Eigen::Matrix4f transform = Eigen::Matrix4f::Identity();
64 transform.block<3, 3>(0, 0) = joint.preRotation.toRotationMatrix();
65 transform.block<3, 1>(0, 3) = joint.translationOffset;
66 return transform;
67}
68
69// Compute world-space bind transform for a joint by walking up the parent chain.
70Eigen::Matrix4f computeWorldTransform(const Skeleton& skeleton, size_t jointIndex) {
72 jointIndex >= skeleton.joints.size(),
73 "Joint index {} exceeds skeleton joint count {}",
74 jointIndex,
75 skeleton.joints.size());
76
77 const auto& joint = skeleton.joints.at(jointIndex);
78 Eigen::Matrix4f world = jointToLocalTransform(joint);
79 size_t parent = joint.parent;
80 while (parent != kInvalidIndex) {
82 parent >= skeleton.joints.size(),
83 "Parent joint index {} exceeds skeleton joint count {}",
84 parent,
85 skeleton.joints.size());
86 const auto& parentJoint = skeleton.joints.at(parent);
87 world = jointToLocalTransform(parentJoint) * world;
88 parent = parentJoint.parent;
89 }
90 return world;
91}
92
93// Extract the leaf name from a hierarchical joint path (e.g., "Root/Spine/Chest" -> "Chest").
94std::string leafName(const std::string& path) {
95 auto pos = path.rfind('/');
96 if (pos == std::string::npos) {
97 return path;
98 }
99 return path.substr(pos + 1);
100}
101
102} // namespace
103
104// Build hierarchical joint paths from flat names and parent indices.
105// E.g., joint 0 "root" (no parent) -> "root"
106// joint 1 "spine" (parent 0) -> "root/spine"
107// joint 2 "chest" (parent 1) -> "root/spine/chest"
108std::vector<std::string> buildHierarchicalPaths(const Skeleton& skeleton) {
109 std::vector<std::string> paths(skeleton.joints.size());
110 for (size_t i = 0; i < skeleton.joints.size(); ++i) {
111 const auto& joint = skeleton.joints.at(i);
112 if (joint.parent == kInvalidIndex) {
113 paths.at(i) = joint.name;
114 } else {
116 joint.parent >= paths.size(),
117 "Parent joint index {} exceeds paths size {} for joint {}",
118 joint.parent,
119 paths.size(),
120 i);
121 paths.at(i) = paths.at(joint.parent) + "/" + joint.name;
122 }
123 }
124 return paths;
125}
126
127Skeleton loadSkeletonFromUsd(const UsdStageRefPtr& stage) {
128 Skeleton skeleton;
129
130 UsdSkelCache skelCache;
131
132 for (const auto& prim : stage->Traverse()) {
133 if (!prim.IsA<UsdSkelSkeleton>()) {
134 continue;
135 }
136
137 UsdSkelSkeleton skelPrim(prim);
138 UsdSkelSkeletonQuery skelQuery = skelCache.GetSkelQuery(skelPrim);
139 if (!skelQuery) {
140 continue;
141 }
142
143 VtArray<TfToken> jointNames = skelQuery.GetJointOrder();
144 if (jointNames.empty()) {
145 continue;
146 }
147
148 skeleton.joints.reserve(jointNames.size());
149
150 // Get parent topology (derived from hierarchical joint paths)
151 VtArray<int> topology = skelQuery.GetTopology().GetParentIndices();
152
153 for (size_t i = 0; i < jointNames.size(); ++i) {
154 Joint joint;
155 // Extract the leaf name from the hierarchical path
156 joint.name = leafName(jointNames[i].GetString());
157
158 if (i < topology.size() && topology[i] >= 0) {
159 joint.parent = topology[i];
160 } else {
161 joint.parent = kInvalidIndex;
162 }
163
164 joint.preRotation = Eigen::Quaternionf::Identity();
165 joint.translationOffset = Eigen::Vector3f::Zero();
166
167 skeleton.joints.push_back(joint);
168 }
169
170 // Prefer local rest transforms when available (preserves exact joint data)
171 VtArray<GfMatrix4d> restTransforms;
172 if (skelPrim.GetRestTransformsAttr().Get(&restTransforms) &&
173 restTransforms.size() == skeleton.joints.size()) {
174 for (size_t i = 0; i < restTransforms.size(); ++i) {
175 auto matrix = toEigenMatrix4f(restTransforms[i]);
176 skeleton.joints[i].translationOffset = matrix.block<3, 1>(0, 3);
177 Eigen::Matrix3f rotMatrix = matrix.block<3, 3>(0, 0);
178 skeleton.joints[i].preRotation = Eigen::Quaternionf(rotMatrix).normalized();
179 }
180 } else {
181 // Fall back to world-space bind transforms
182 VtArray<GfMatrix4d> bindTransforms;
183 if (skelQuery.GetJointWorldBindTransforms(&bindTransforms)) {
184 MT_CHECK(bindTransforms.size() == skeleton.joints.size());
185
186 for (size_t i = 0; i < bindTransforms.size(); ++i) {
187 Eigen::Matrix4f worldMatrix = toEigenMatrix4f(bindTransforms[i]);
188
189 // Convert world-space to local-space by removing parent's world transform
190 Eigen::Matrix4f localMatrix;
191 if (skeleton.joints[i].parent != kInvalidIndex) {
193 skeleton.joints[i].parent >= bindTransforms.size(),
194 "Parent joint index {} exceeds bindTransforms size {}",
195 skeleton.joints[i].parent,
196 bindTransforms.size());
197 Eigen::Matrix4f parentWorld =
198 toEigenMatrix4f(bindTransforms[skeleton.joints[i].parent]);
199 localMatrix = parentWorld.inverse() * worldMatrix;
200 } else {
201 localMatrix = worldMatrix;
202 }
203
204 skeleton.joints[i].translationOffset = localMatrix.block<3, 1>(0, 3);
205 Eigen::Matrix3f rotMatrix = localMatrix.block<3, 3>(0, 0);
206 skeleton.joints[i].preRotation = Eigen::Quaternionf(rotMatrix).normalized();
207 }
208 }
209 }
210
211 break; // Use first skeleton found
212 }
213
214 return skeleton;
215}
216
217void saveSkeletonToUsd(const Skeleton& skeleton, UsdSkelSkeleton& skelPrim) {
218 // Write joint names as hierarchical paths (encodes parent topology)
219 const auto paths = buildHierarchicalPaths(skeleton);
220 VtArray<TfToken> jointTokens;
221 jointTokens.reserve(skeleton.joints.size());
222 for (const auto& path : paths) {
223 jointTokens.push_back(TfToken(path));
224 }
225 skelPrim.GetJointsAttr().Set(jointTokens);
226
227 // Write local rest transforms (preserves exact joint data)
228 VtArray<GfMatrix4d> restTransforms;
229 restTransforms.reserve(skeleton.joints.size());
230 for (const auto& joint : skeleton.joints) {
231 restTransforms.push_back(toGfMatrix4d(jointToLocalTransform(joint)));
232 }
233 skelPrim.GetRestTransformsAttr().Set(restTransforms);
234
235 // Write world-space bind transforms (for interop with standard USD viewers)
236 VtArray<GfMatrix4d> bindTransforms;
237 bindTransforms.reserve(skeleton.joints.size());
238 for (size_t i = 0; i < skeleton.joints.size(); ++i) {
239 bindTransforms.push_back(toGfMatrix4d(computeWorldTransform(skeleton, i)));
240 }
241 skelPrim.GetBindTransformsAttr().Set(bindTransforms);
242}
243
245 const CollisionGeometry& collision,
246 const Skeleton& skeleton,
247 const UsdStageRefPtr& stage,
248 const SdfPath& skelRootPath) {
249 if (collision.empty() || skeleton.joints.empty()) {
250 return;
251 }
252
253 auto collisionScope = UsdGeomScope::Define(stage, skelRootPath.AppendChild(_tokens->Collision));
254
255 for (size_t i = 0; i < collision.size(); ++i) {
256 const auto& primitive = collision[i];
257
258 std::string type;
259 switch (primitive.type) {
261 type = "collision_capsule";
262 break;
264 type = "collision_ellipsoid";
265 break;
267 type = "collision_box";
268 break;
269 }
270
271 const std::string jointName = (primitive.parent < skeleton.joints.size())
272 ? skeleton.joints.at(primitive.parent).name
273 : "unknown";
274 const std::string primName = sanitizePrimName(jointName + "_col_" + std::to_string(i));
275
276 auto primPath = collisionScope.GetPath().AppendChild(TfToken(primName));
277 auto prim = stage->DefinePrim(primPath);
279 !prim.IsValid(),
280 "Failed to create collision prim '{}' (from joint '{}')",
281 primName,
282 jointName);
283
284 prim.CreateAttribute(_tokens->momentumType, SdfValueTypeNames->String).Set(type);
285 prim.CreateAttribute(_tokens->momentumParent, SdfValueTypeNames->String).Set(jointName);
286 if (primitive.type == CollisionPrimitiveType::TaperedCapsule) {
287 prim.CreateAttribute(_tokens->momentumLength, SdfValueTypeNames->Float).Set(primitive.length);
288 prim.CreateAttribute(_tokens->momentumRadius, SdfValueTypeNames->Float2)
289 .Set(GfVec2f(primitive.radius.x(), primitive.radius.y()));
290 } else if (primitive.type == CollisionPrimitiveType::Ellipsoid) {
291 prim.CreateAttribute(_tokens->momentumRadii, SdfValueTypeNames->Float3)
292 .Set(GfVec3f(
293 primitive.ellipsoidRadii.x(),
294 primitive.ellipsoidRadii.y(),
295 primitive.ellipsoidRadii.z()));
296 } else if (primitive.type == CollisionPrimitiveType::Box) {
297 prim.CreateAttribute(_tokens->momentumHalfExtents, SdfValueTypeNames->Float3)
298 .Set(GfVec3f(
299 primitive.boxHalfExtents.x(),
300 primitive.boxHalfExtents.y(),
301 primitive.boxHalfExtents.z()));
302 }
303
304 const auto& t = primitive.transformation.translation;
305 prim.CreateAttribute(_tokens->momentumTranslation, SdfValueTypeNames->Float3)
306 .Set(GfVec3f(t.x(), t.y(), t.z()));
307
308 const auto& q = primitive.transformation.rotation;
309 prim.CreateAttribute(_tokens->momentumRotation, SdfValueTypeNames->Quatf)
310 .Set(GfQuatf(q.w(), q.x(), q.y(), q.z()));
311 }
312}
313
315 const UsdStageRefPtr& stage,
316 const Skeleton& skeleton) {
317 CollisionGeometry result;
318
319 for (const auto& prim : stage->Traverse()) {
320 auto typeAttr = prim.GetAttribute(_tokens->momentumType);
321 if (!typeAttr) {
322 continue;
323 }
324
325 std::string type;
326 if (!typeAttr.Get(&type) ||
327 (type != "collision_capsule" && type != "collision_ellipsoid" && type != "collision_box")) {
328 continue;
329 }
330
331 CollisionPrimitive primitive;
332
333 std::string parentName;
334 if (auto attr = prim.GetAttribute(_tokens->momentumParent); attr) {
335 attr.Get(&parentName);
336 primitive.parent = skeleton.getJointIdByName(parentName);
337 }
338
339 if (type == "collision_capsule") {
341 if (auto attr = prim.GetAttribute(_tokens->momentumLength); attr) {
342 attr.Get(&primitive.length);
343 }
344
345 GfVec2f radius(0.0f, 0.0f);
346 if (auto attr = prim.GetAttribute(_tokens->momentumRadius); attr) {
347 attr.Get(&radius);
348 primitive.radius = Eigen::Vector2f(radius[0], radius[1]);
349 }
350 } else if (type == "collision_ellipsoid") {
352 GfVec3f radii(0.0f, 0.0f, 0.0f);
353 if (auto attr = prim.GetAttribute(_tokens->momentumRadii); attr) {
354 attr.Get(&radii);
355 primitive.ellipsoidRadii = Eigen::Vector3f(radii[0], radii[1], radii[2]);
356 }
357 } else if (type == "collision_box") {
359 GfVec3f halfExtents(0.0f, 0.0f, 0.0f);
360 if (auto attr = prim.GetAttribute(_tokens->momentumHalfExtents); attr) {
361 attr.Get(&halfExtents);
362 primitive.boxHalfExtents = Eigen::Vector3f(halfExtents[0], halfExtents[1], halfExtents[2]);
363 }
364 }
365
366 GfVec3f translation(0.0f, 0.0f, 0.0f);
367 if (auto attr = prim.GetAttribute(_tokens->momentumTranslation); attr) {
368 attr.Get(&translation);
369 primitive.transformation.translation =
370 Eigen::Vector3f(translation[0], translation[1], translation[2]);
371 }
372
373 GfQuatf rotation(1.0f);
374 if (auto attr = prim.GetAttribute(_tokens->momentumRotation); attr) {
375 attr.Get(&rotation);
376 primitive.transformation.rotation = Eigen::Quaternionf(
377 rotation.GetReal(),
378 rotation.GetImaginary()[0],
379 rotation.GetImaginary()[1],
380 rotation.GetImaginary()[2]);
381 }
382
383 result.push_back(primitive);
384 }
385
386 return result;
387}
388
390 const LocatorList& locators,
391 const Skeleton& skeleton,
392 const UsdStageRefPtr& stage,
393 const SdfPath& skelRootPath) {
394 if (locators.empty() || skeleton.joints.empty()) {
395 return;
396 }
397
398 auto locatorScope = UsdGeomScope::Define(stage, skelRootPath.AppendChild(_tokens->Locators));
399
400 for (size_t i = 0; i < locators.size(); ++i) {
401 const auto& loc = locators[i];
402 const std::string baseName = loc.name.empty() ? "locator" : loc.name;
403 const std::string primName = sanitizePrimName(baseName + "_" + std::to_string(i));
404
405 auto primPath = locatorScope.GetPath().AppendChild(TfToken(primName));
406 auto prim = stage->DefinePrim(primPath);
408 !prim.IsValid(),
409 "Failed to create locator prim '{}' (from locator '{}')",
410 primName,
411 loc.name);
412
413 prim.CreateAttribute(_tokens->momentumType, SdfValueTypeNames->String)
414 .Set(std::string("locator"));
415 // Store the original unsanitized name for round-trip fidelity
416 prim.CreateAttribute(_tokens->momentumName, SdfValueTypeNames->String).Set(loc.name);
417
418 const std::string parentName =
419 (loc.parent < skeleton.joints.size()) ? skeleton.joints.at(loc.parent).name : "";
420 prim.CreateAttribute(_tokens->momentumParent, SdfValueTypeNames->String).Set(parentName);
421
422 prim.CreateAttribute(_tokens->momentumOffset, SdfValueTypeNames->Float3)
423 .Set(GfVec3f(loc.offset.x(), loc.offset.y(), loc.offset.z()));
424
425 prim.CreateAttribute(_tokens->momentumWeight, SdfValueTypeNames->Float).Set(loc.weight);
426
427 prim.CreateAttribute(_tokens->momentumLocked, SdfValueTypeNames->Int3)
428 .Set(GfVec3i(loc.locked.x(), loc.locked.y(), loc.locked.z()));
429
430 prim.CreateAttribute(_tokens->momentumLimitOrigin, SdfValueTypeNames->Float3)
431 .Set(GfVec3f(loc.limitOrigin.x(), loc.limitOrigin.y(), loc.limitOrigin.z()));
432
433 prim.CreateAttribute(_tokens->momentumLimitWeight, SdfValueTypeNames->Float3)
434 .Set(GfVec3f(loc.limitWeight.x(), loc.limitWeight.y(), loc.limitWeight.z()));
435
436 if (loc.attachedToSkin) {
437 prim.CreateAttribute(_tokens->momentumAttachedToSkin, SdfValueTypeNames->Bool).Set(true);
438 prim.CreateAttribute(_tokens->momentumSkinOffset, SdfValueTypeNames->Float)
439 .Set(loc.skinOffset);
440 }
441 }
442}
443
444LocatorList loadLocatorsFromUsd(const UsdStageRefPtr& stage, const Skeleton& skeleton) {
445 LocatorList result;
446
447 for (const auto& prim : stage->Traverse()) {
448 auto typeAttr = prim.GetAttribute(_tokens->momentumType);
449 if (!typeAttr) {
450 continue;
451 }
452
453 std::string type;
454 if (!typeAttr.Get(&type) || type != "locator") {
455 continue;
456 }
457
458 Locator loc;
459 if (auto attr = prim.GetAttribute(_tokens->momentumName); attr) {
460 attr.Get(&loc.name);
461 } else {
462 loc.name = prim.GetName().GetString();
463 }
464
465 std::string parentName;
466 if (auto attr = prim.GetAttribute(_tokens->momentumParent); attr) {
467 attr.Get(&parentName);
468 if (!parentName.empty()) {
469 loc.parent = skeleton.getJointIdByName(parentName);
470 }
471 }
472
473 GfVec3f offset(0.0f, 0.0f, 0.0f);
474 if (auto attr = prim.GetAttribute(_tokens->momentumOffset); attr) {
475 attr.Get(&offset);
476 loc.offset = Eigen::Vector3f(offset[0], offset[1], offset[2]);
477 }
478
479 if (auto attr = prim.GetAttribute(_tokens->momentumWeight); attr) {
480 attr.Get(&loc.weight);
481 }
482
483 GfVec3i locked(0, 0, 0);
484 if (auto attr = prim.GetAttribute(_tokens->momentumLocked); attr) {
485 attr.Get(&locked);
486 loc.locked = Eigen::Vector3i(locked[0], locked[1], locked[2]);
487 }
488
489 GfVec3f limitOrigin(0.0f, 0.0f, 0.0f);
490 if (auto attr = prim.GetAttribute(_tokens->momentumLimitOrigin); attr) {
491 attr.Get(&limitOrigin);
492 loc.limitOrigin = Eigen::Vector3f(limitOrigin[0], limitOrigin[1], limitOrigin[2]);
493 }
494
495 GfVec3f limitWeight(0.0f, 0.0f, 0.0f);
496 if (auto attr = prim.GetAttribute(_tokens->momentumLimitWeight); attr) {
497 attr.Get(&limitWeight);
498 loc.limitWeight = Eigen::Vector3f(limitWeight[0], limitWeight[1], limitWeight[2]);
499 }
500
501 if (auto attr = prim.GetAttribute(_tokens->momentumAttachedToSkin); attr) {
502 attr.Get(&loc.attachedToSkin);
503 }
504
505 if (auto attr = prim.GetAttribute(_tokens->momentumSkinOffset); attr) {
506 attr.Get(&loc.skinOffset);
507 }
508
509 result.push_back(std::move(loc));
510 }
511
512 return result;
513}
514
515} // namespace momentum
#define MT_CHECK(condition,...)
Runtime check macros with two interchangeable backends:
Definition checks.h:36
#define MT_THROW_IF(Condition,...)
Conditionally throws a std::runtime_error with a formatted message if the condition is true.
Definition exception.h:55
Skeleton loadSkeletonFromUsd(const UsdStageRefPtr &stage)
Load a skeleton from a USD stage.
CollisionGeometryT< float > CollisionGeometry
SkeletonT< float > Skeleton
Definition fwd.h:263
void saveSkeletonToUsd(const Skeleton &skeleton, UsdSkelSkeleton &skelPrim)
Save a skeleton to a USD stage.
void saveCollisionGeometryToUsd(const CollisionGeometry &collision, const Skeleton &skeleton, const UsdStageRefPtr &stage, const SdfPath &skelRootPath)
Save collision geometry as child prims under the skeleton.
CollisionPrimitiveT< float > CollisionPrimitive
Definition fwd.h:111
std::string sanitizePrimName(const std::string &name)
Sanitize a string for use as a USD SDF prim name.
Definition usd_utils.cpp:14
LocatorList loadLocatorsFromUsd(const UsdStageRefPtr &stage, const Skeleton &skeleton)
Load locators from child prims.
JointT< float > Joint
Definition fwd.h:206
void saveLocatorsToUsd(const LocatorList &locators, const Skeleton &skeleton, const UsdStageRefPtr &stage, const SdfPath &skelRootPath)
Save locators as child prims under the skeleton.
constexpr size_t kInvalidIndex
Sentinel value indicating an invalid or unset size_t index.
Definition types.h:182
CollisionGeometry loadCollisionGeometryFromUsd(const UsdStageRefPtr &stage, const Skeleton &skeleton)
Load collision geometry from child prims.
std::vector< std::string > buildHierarchicalPaths(const Skeleton &skeleton)
Build hierarchical joint paths from flat names and parent indices.
std::vector< Locator > LocatorList
A collection of locators attached to a skeleton.
Definition locator.h:79
S length
Length of a tapered capsule along the x-axis.
Vector3< S > boxHalfExtents
Half extents along the local axes of a box.
TransformT< S > transformation
Transformation defining the primitive pose relative to the parent coordinate system.
size_t parent
Parent joint to which the geometry is attached.
Vector2< S > radius
Radii at the two endpoints of a tapered capsule.
CollisionPrimitiveType type
Primitive kind.
Vector3< S > ellipsoidRadii
Radii along the local axes of an ellipsoid.
size_t parent
Index of the parent joint in the skeleton hierarchy, or kInvalidIndex for the root.
Definition joint.h:24
Quaternion< T > preRotation
Pre-rotation from the parent joint's axes to this joint's local axes.
Definition joint.h:32
Vector3< T > translationOffset
Constant translation offset from the parent joint's origin to this joint's origin,...
Definition joint.h:36
std::string name
Definition joint.h:21
Represents a point attached to a joint in a skeleton.
Definition locator.h:19
float weight
Influence weight when used as a constraint in error functions.
Definition locator.h:32
size_t parent
Index of the parent joint in the skeleton.
Definition locator.h:23
std::string name
Definition locator.h:20
float skinOffset
Offset from the skin surface, used when solving for body shape using locators.
Definition locator.h:46
Vector3f limitWeight
Per-axis strength pulling the locator back toward limitOrigin.
Definition locator.h:39
Vector3i locked
Per-axis lock flags (x, y, z): 1 = locked, 0 = free.
Definition locator.h:29
bool attachedToSkin
True if the locator is attached to the skin of a person (e.g.
Definition locator.h:43
Vector3f offset
Position in the parent joint's local coordinate frame.
Definition locator.h:26
Vector3f limitOrigin
Reference position for limit constraints; typically equals offset when loaded.
Definition locator.h:35
size_t getJointIdByName(std::string_view name) const
Returns the index of a joint with the given name, or kInvalidIndex if not found.
Definition skeleton.cpp:25
JointList joints
The list of joints in this skeleton, ordered such that every joint's parent appears earlier in the li...
Definition skeleton.h:25
Vector3< T > translation
Definition transform.h:40
Quaternion< T > rotation
Unit quaternion encoding the rotation.
Definition transform.h:39
PXR_NAMESPACE_USING_DIRECTIVE TF_DEFINE_PRIVATE_TOKENS(_tokens,(Collision)(Locators)((momentumType, "momentum:type"))((momentumParent, "momentum:parent"))((momentumLength, "momentum:length"))((momentumRadius, "momentum:radius"))((momentumRadii, "momentum:radii"))((momentumHalfExtents, "momentum:halfExtents"))((momentumTranslation, "momentum:translation"))((momentumRotation, "momentum:rotation"))((momentumName, "momentum:name"))((momentumOffset, "momentum:offset"))((momentumWeight, "momentum:weight"))((momentumLocked, "momentum:locked"))((momentumLimitOrigin, "momentum:limitOrigin"))((momentumLimitWeight, "momentum:limitWeight"))((momentumAttachedToSkin, "momentum:attachedToSkin"))((momentumSkinOffset, "momentum:skinOffset")))