SuperDex Physics C++ API
Loading...
Searching...
No Matches
mochi_prefab.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// Documentation for all public types and functions in this file lives:
18// mochi_physics/mochi_physics_prefab.mochi_gen
19
20#pragma once
21
23
27
29
30#include <optional>
31#include <string_view>
32
34
35/***********************************************************************************************
36 Prefab Types:
37*/
38
40 std::optional<DynamicString> comment = std::nullopt;
42 std::optional<Real3> gravity = std::nullopt;
43 std::optional<SolverParams> solver = std::nullopt;
44
45#if MOCHI_LANGUAGE_CPP20
46 bool operator==(SceneParams const&) const = default;
47#endif
48};
49
51 bool enable = true;
54
55#if MOCHI_LANGUAGE_CPP20
56 bool operator==(ActorContactEntry const&) const = default;
57#endif
58};
59
61 bool enable = true;
63
64#if MOCHI_LANGUAGE_CPP20
65 bool operator==(LayerContactEntry const&) const = default;
66#endif
67};
68
70 std::optional<DynamicString> comment = std::nullopt;
71 std::optional<DynamicArray<ActorContactEntry>> actorContactAsymmetric{};
72 std::optional<DynamicArray<ActorContactEntry>> actorContactSymmetric{};
73 std::optional<DynamicArray<LayerContactEntry>> layerContactAsymmetric{};
74 std::optional<DynamicArray<LayerContactEntry>> layerContactSymmetric{};
75
76#if MOCHI_LANGUAGE_CPP20
77 bool operator==(ContactFilter const&) const = default;
78#endif
79};
80
89
91 std::optional<DynamicString> comment = std::nullopt;
93 Real3 scale{1_r, 1_r, 1_r};
99 Real3 renderModelScale = {1_r, 1_r, 1_r};
102
103#if MOCHI_LANGUAGE_CPP20
104 bool operator==(RigidActorPrefab const&) const = default;
105#endif
106};
107
131
133#if MOCHI_LANGUAGE_CPP20
134 bool operator==(ArticulatedJointPrefab const&) const = default;
135#endif
136};
137
152
155
156 // TODO[T265138451]: Add support for baked-in transform
157 // Real3 shapeScale = {1_r, 1_r, 1_r};
158 // Quaternion shapeRotation;
159 // Real3 shapeTranslation = {};
160
162 Real3 renderModelScale = {1_r, 1_r, 1_r};
165
166#if MOCHI_LANGUAGE_CPP20
167 bool operator==(ArticulatedSkinPrefab const&) const = default;
168#endif
169};
170
172 std::optional<DynamicString> comment = std::nullopt;
174 real scale = 1_r;
180 std::optional<ArticulatedSkinPrefab> skin;
181 std::optional<DynamicArray<real>> jointVelocities;
182 std::optional<DynamicArray<real>> jointPose;
183
184#if MOCHI_LANGUAGE_CPP20
185 bool operator==(ArticulatedActorPrefab const&) const = default;
186#endif
187};
188
190 std::optional<DynamicString> comment = std::nullopt;
195 bool hasGravity = false;
196 bool hasInertia = false;
197 bool hasStress = false;
198
199#if MOCHI_LANGUAGE_CPP20
200 bool operator==(SoftSkinnedActorPrefab const&) const = default;
201#endif
202};
203
205 std::optional<DynamicString> comment = std::nullopt;
210
211#if MOCHI_LANGUAGE_CPP20
212 bool operator==(ActorLists const&) const = default;
213#endif
214};
215
224
233
243
252
261
264
265#if MOCHI_LANGUAGE_CPP20
266 bool operator==(RigidPivotPositionConstraintPrefab const&) const = default;
267#endif
268};
269
277
280
281#if MOCHI_LANGUAGE_CPP20
282 bool operator==(RigidPivotRotationConstraintPrefab const&) const = default;
283#endif
284};
285
293
302
311
320
329
338
339/////////////////
340
362
374
375struct ScenePrefab;
376
378 std::optional<DynamicString> comment = std::nullopt;
381 real scale = 1_r;
384
385 // Loaded prefab. Runtime state, not serialized.
387
388#if MOCHI_LANGUAGE_CPP20
389 bool operator==(PrefabReference const&) const = default;
390#endif
391};
392
394 std::optional<DynamicString> comment = std::nullopt;
399 std::optional<SceneParams> scene = std::nullopt;
400 std::optional<DynamicString> sourceFilePath = std::nullopt;
401 std::optional<ContactFilter> contactFilter = std::nullopt;
402 std::optional<DynamicArray<ContactPairParamsOverrideEntry>> contactPairParamsOverrides =
403 std::nullopt;
404
405#if MOCHI_LANGUAGE_CPP20
406 bool operator==(ScenePrefab const&) const = default;
407#endif
408};
409
410/***********************************************************************************************
411 Prefab Serialization:
412*/
413
415 std::string_view prefabPath,
416 std::string_view rootPath,
417 Context* context,
418 Error& error);
419
421 std::string_view json,
422 std::string_view rootPath,
423 Context* context,
424 Error& error);
425
426MOCHI_API void SaveToJsonFile(ScenePrefab const& prefab, std::string_view path, Error& error);
427
429
430/***********************************************************************************************
431 Prefab Instantiation:
432*/
433
441
449
451AddToScene(ScenePrefab const& prefab, Scene* scene, PrefabParams const& params, Error& error);
452
454
456 std::string_view prefabPath,
457 std::string_view rootPath,
458 Scene* scene,
459 PrefabParams const& params,
460 Error& error);
461
463AddToScene(std::string_view prefabPath, std::string_view rootPath, Scene* scene, Error& error);
464
465/***********************************************************************************************
466 Prefab Utilities:
467*/
468
470 std::string_view inputPath,
471 std::string_view rootForRelativePath,
472 std::string_view prefabFilePath);
473
474MOCHI_API ScenePrefab ShallowLoadFromFile(std::string_view path, Error& error);
475
477
478MOCHI_API void LoadNestedPrefabs(ScenePrefab& prefab, std::string_view rootPath, Error& error);
479
480MOCHI_API void
481LoadShapes(ScenePrefab& prefab, std::string_view rootPath, Context* context, Error& error);
482
483MOCHI_API void
484EnsureFullyLoaded(ScenePrefab& prefab, std::string_view rootPath, Context* context, Error& error);
485
490
492 Scene const* scene,
493 std::string_view exportName,
494 std::string_view outputDir,
495 ExportParams const& params,
496 Error& error);
497
499 Scene const* scene,
500 std::string_view exportName,
501 std::string_view outputDir,
502 Error& error);
503
505 Actor const* actor,
506 std::string_view exportName,
507 std::string_view outputDir,
508 ExportParams const& params,
509 Error& error);
510
512 Actor const* actor,
513 std::string_view exportName,
514 std::string_view outputDir,
515 Error& error);
516
517} // namespace superdex::prefab
518
520
521#if MOCHI_USE_REFLECTION
523#endif
Represents a simulated body (actor) in a scene.
Definition mochi_actor.h:49
Main entry point for SuperDex Physics simulation.
A dynamically resizable array with syntax and behavior similar to std::pmr::vector.
Represents a simulation scene.
Definition mochi_scene.h:45
#define MOCHI_API
void LoadNestedPrefabs(ScenePrefab &prefab, std::string_view rootPath, Error &error)
Load nested prefab files recursively.
AddToSceneResult AddToScene(ScenePrefab const &prefab, Scene *scene, PrefabParams const &params, Error &error)
Instantiate a ScenePrefab and add it to a Scene.
DynamicString SaveToJsonString(ScenePrefab const &prefab, Error &error)
Serialize a ScenePrefab to a JSON string.
ScenePrefab ShallowLoadFromJsonString(std::string_view json, Error &error)
Deserialize a single ScenePrefab from a JSON string, without loading any nested files.
DynamicString GetPrefabFullPath(std::string_view inputPath, std::string_view rootForRelativePath, std::string_view prefabFilePath)
Resolve a path referenced inside a prefab to a full path.
void LoadShapes(ScenePrefab &prefab, std::string_view rootPath, Context *context, Error &error)
Load shape files referenced by prefab and its loaded nested prefabs.
void SaveToJsonFile(ScenePrefab const &prefab, std::string_view path, Error &error)
Serialize a ScenePrefab to a JSON file.
ScenePrefab ShallowLoadFromFile(std::string_view path, Error &error)
Deserialize a single ScenePrefab from a file, without loading any nested files.
ScenePrefab LoadFromFile(std::string_view prefabPath, std::string_view rootPath, Context *context, Error &error)
Fully load a ScenePrefab from a file, including all nested prefabs and shapes.
ScenePrefab LoadFromJsonString(std::string_view json, std::string_view rootPath, Context *context, Error &error)
Fully load a ScenePrefab from a JSON string, including all nested prefabs and shapes.
void ExportActor(Actor const *actor, std::string_view exportName, std::string_view outputDir, ExportParams const &params, Error &error)
Export a single actor to a prefab file under outputDir/exportName/<exportName>.mochi_scene.
void ExportScene(Scene const *scene, std::string_view exportName, std::string_view outputDir, ExportParams const &params, Error &error)
Export a Scene to a folder containing a prefab file and all generated mesh files.
void EnsureFullyLoaded(ScenePrefab &prefab, std::string_view rootPath, Context *context, Error &error)
Ensure that all nested prefabs and shape files are loaded, skipping any that are already loaded.
NdArray< real, 3 > Real3
Definition nd_array.h:115
ConstraintType
Type of constraint acting on actors' degrees of freedom.
Definition mochi_enums.h:79
ColliderType
Collision detection geometry for an Actor.
@ None
No collision representation.
std::basic_string< char, std::char_traits< char >, StlAllocator< char > > DynamicString
Alias for std::string using a polymorphic superdex::Allocator pointer.
ActorType
Type of actor.
Definition mochi_enums.h:25
Parameters for creating a range constraint on a 3D-rotation articulated joint.
Parameters for creating a target constraint on 3D rotation DoFs of an articulated actor.
Parameters describing a single joint within an articulated actor.
Parameters describing a single rigid link within an articulated actor.
Parameters for creating a range constraint on a single articulated DoF.
Parameters for creating a target constraint on a single articulated DoF.
Optional skinned mesh attached to an articulated actor for collision and rendering.
Optional contact-response parameter replacements for an unordered actor pair.
Parameters for creating a position constraint on a deformable actor node.
Parameters for creating a constraint coupling a node in a deformable actor to a node in another defor...
Parameters for creating a constraint coupling a deformable node to a rigid actor.
Parameters controlling the resolution of grid-based Signed Distance Fields (SDF).
Parameters for creating a joint rotation range constraint between two rigid actors.
Parameters for creating a joint rotation tracking constraint between two rigid actors.
Runtime handle to a loaded nested prefab (the resolved target of a prefab::PrefabReference).
Parameters to create a rigid body actor.
Parameters for creating a position constraint on a rigid actor's pivot point.
Parameters for creating a rotation constraint on a rigid actor's pivot frame.
Parameters for creating a constraint on a rigid actor's pivot point.
Parameters for creating a prismatic joint between two rigid actors.
Parameters for creating a spherical joint between two rigid actors.
Handle to a shape (mesh, sphere, plane, etc.) within a Context.
Parameters to create a soft deformable actor.
Used by ContactFilter to enable or disable contact for a pair of actors.
bool enable
Enable (true) or disable (false) contact for the specified pair of actors.
DynamicArray< DynamicString > actors
Identifies two actors by name or hierarchy path.
bool includeNestedActors
Whether expandable parent actor names should include nested actors.
bool operator==(ActorContactEntry const &) const =default
Lists of actors grouped by type.
DynamicArray< ArticulatedActorPrefab > articulated
Articulated actors.
std::optional< DynamicString > comment
Optional serialized comment.
bool operator==(ActorLists const &) const =default
DynamicArray< RigidActorPrefab > rigid
Rigid actors.
DynamicArray< SoftActorPrefab > soft
Soft actors.
DynamicArray< SoftSkinnedActorPrefab > softSkinned
Soft-skinned actors.
Struct used to return all created actors and constraints from AddToScene.
DynamicArray< Actor * > Filter(ActorType type) const
Return all the newly created actors of a particular type, in order.
DynamicArray< Constraint * > constraints
All newly created constraints.
DynamicArray< Constraint * > Filter(ConstraintType type) const
Return all the newly created constraints of a particular type, in order.
DynamicArray< Actor * > actors
All newly created actors.
Prefab parameters for a Articulated3dRotationRangeConstraintParams.
DynamicString actorName
Name or hierarchy path identifying the articulated actor.
bool operator==(Articulated3dRotationRangeConstraintPrefab const &) const =default
Prefab parameters for a Articulated3dRotationTargetConstraintParams.
DynamicString actorName
Name or hierarchy path identifying the articulated actor.
bool operator==(Articulated3dRotationTargetConstraintPrefab const &) const =default
Prefab parameters for an articulated actor.
real scale
Uniform scale baked into all link and skin shapes when the prefab is instantiated.
bool operator==(ArticulatedActorPrefab const &) const =default
DynamicArray< ArticulatedLinkPrefab > links
Link parameters (one per link).
DynamicString name
Optional actor name.
std::optional< DynamicString > comment
Optional serialized comment.
Real3 translation
Actor translation [x, y, z] relative to the prefab's local frame (i.e., the prefab-from-root translat...
DynamicArray< ArticulatedJointPrefab > joints
Joint parameters (one per joint).
DynamicArray< ArticulatedCycleJointParams > cycles
Cycle joints creating closed kinematic loops.
Quaternion rotation
Actor rotation quaternion [x, y, z, w] relative to the prefab's local frame (i.e.,...
std::optional< DynamicArray< real > > jointPose
Optional initial joint pose, one value per DoF in joint order.
std::optional< DynamicArray< real > > jointVelocities
Optional initial velocity per DoF.
std::optional< ArticulatedSkinPrefab > skin
Optional skinned mesh parameters.
Joint parameters for an articulated actor prefab.
bool operator==(ArticulatedJointPrefab const &) const =default
Link parameters for an articulated actor prefab.
bool operator==(ArticulatedLinkPrefab const &) const =default
DynamicString shapeFile
Path to a simulation model file defining the geometry of the rigid link actor.
Real3 shapeScale
Scale [x, y, z] to bake into the shape file.
Real3 shapeTranslation
Translation [x, y, z] to bake into the shape file.
Quaternion renderModelRotation
Rotation quaternion [x, y, z, w] to apply to the render model.
Quaternion shapeRotation
Rotation quaternion [x, y, z, w] to bake into the shape file.
Real3 renderModelTranslation
Translation [x, y, z] to apply to the render model.
DynamicString renderModelFile
Optional path to a render model file (e.g.
Real3 renderModelScale
Scale [x, y, z] to apply to the render model.
Prefab parameters for a ArticulatedSingleDofRangeConstraintParams.
DynamicString actorName
Name or hierarchy path identifying the articulated actor.
bool operator==(ArticulatedSingleDofRangeConstraintPrefab const &) const =default
Prefab parameters for a ArticulatedSingleDofTargetConstraintParams.
DynamicString actorName
Name or hierarchy path identifying the articulated actor.
bool operator==(ArticulatedSingleDofTargetConstraintPrefab const &) const =default
Skin parameters for an articulated actor prefab.
Real3 renderModelScale
Scale [x, y, z] to apply to the render model.
DynamicString renderModelFile
Optional path to a render model file (e.g.
bool operator==(ArticulatedSkinPrefab const &) const =default
Quaternion renderModelRotation
Rotation quaternion [x, y, z, w] to apply to the render model.
Real3 renderModelTranslation
Translation [x, y, z] to apply to the render model.
DynamicString shapeFile
Path to the model file containing a skinned mesh.
Lists of constraints grouped by type.
DynamicArray< RigidPivotToRigidTargetConstraintPrefab > rigidPivotToRigidTarget
Position constraints attaching a rigid actor's pivot point to a rigid target.
DynamicArray< RigidPivotPositionConstraintPrefab > rigidPivotPosition
Position constraints on a rigid actor's pivot point.
bool operator==(ConstraintLists const &) const =default
DynamicArray< RigidPrismaticJointConstraintPrefab > rigidPrismaticJoint
Prismatic joint constraints between two rigid actors.
DynamicArray< Articulated3dRotationTargetConstraintPrefab > articulated3dRotationTarget
3D rotation target constraints on articulated actors.
DynamicArray< JointRotationTrackingConstraintPrefab > jointRotationTracking
Joint rotation tracking constraints.
DynamicArray< ArticulatedSingleDofRangeConstraintPrefab > articulatedSingleDofRange
Single-DoF range constraints on articulated actors.
DynamicArray< JointRotationRangeConstraintPrefab > jointRotationRange
Joint rotation range constraints.
DynamicArray< RigidSphericalJointConstraintPrefab > rigidSphericalJoint
Spherical joint constraints between two rigid actors.
DynamicArray< Articulated3dRotationRangeConstraintPrefab > articulated3dRotationRange
3D rotation range constraints on articulated actors.
DynamicArray< ArticulatedSingleDofTargetConstraintPrefab > articulatedSingleDofTarget
Single-DoF target constraints on articulated actors.
std::optional< DynamicString > comment
Optional serialized comment.
DynamicArray< RigidPivotRotationConstraintPrefab > rigidPivotRotation
Rotation constraints on a rigid actor's pivot frame.
DynamicArray< DeformableNodeToRigidConstraintPrefab > deformableNodeToRigid
Constraints connecting a deformable node to a rigid actor.
DynamicArray< DeformableNodeToDeformableNodeConstraintPrefab > deformableNodeToDeformableNode
Constraints connecting two deformable actor nodes.
DynamicArray< DeformableNodePositionConstraintPrefab > deformableNodePosition
Position constraints on a deformable actor node.
Contact filtering parameters for a prefab.
std::optional< DynamicArray< LayerContactEntry > > layerContactAsymmetric
Enables or disables contact asymmetrically for each ordered pair of layers.
std::optional< DynamicString > comment
Optional serialized comment.
std::optional< DynamicArray< LayerContactEntry > > layerContactSymmetric
Enables or disables contact symmetrically for each pair of layers.
std::optional< DynamicArray< ActorContactEntry > > actorContactAsymmetric
Enables or disables contact asymmetrically for each ordered pair of actors.
bool operator==(ContactFilter const &) const =default
std::optional< DynamicArray< ActorContactEntry > > actorContactSymmetric
Enables or disables contact symmetrically for each pair of actors.
Overrides selected contact parameters for an unordered actor pair.
ContactPairParamsOverride paramsOverride
Partial contact parameter override for the actor pair.
bool operator==(ContactPairParamsOverrideEntry const &) const =default
DynamicArray< DynamicString > actors
Identifies two actors by name or hierarchy path.
Prefab parameters for a DeformableNodePositionConstraintParams.
DynamicString actorName
Name or hierarchy path identifying the deformable actor.
bool operator==(DeformableNodePositionConstraintPrefab const &) const =default
Prefab parameters for a DeformableNodeToDeformableNodeConstraintParams.
DynamicString actorNameA
Name or hierarchy path identifying deformable actor A.
DynamicString actorNameB
Name or hierarchy path identifying deformable actor B.
bool operator==(DeformableNodeToDeformableNodeConstraintPrefab const &) const =default
Prefab parameters for a DeformableNodeToRigidConstraintParams.
DynamicString rigidActorName
Name or hierarchy path identifying the rigid actor.
DynamicString deformableActorName
Name or hierarchy path identifying the deformable actor.
bool operator==(DeformableNodeToRigidConstraintPrefab const &) const =default
Options for ExportScene and ExportActor.
DynamicArray< ActorHandle > excludeActors
Handles of actors that ExportScene should not export.
bool exportCurrentPose
Whether to export the current pose of soft and articulated actors.
Prefab parameters for a JointRotationRangeConstraintParams.
DynamicString actorNameB
Name or hierarchy path identifying rigid actor B.
bool operator==(JointRotationRangeConstraintPrefab const &) const =default
DynamicString actorNameA
Name or hierarchy path identifying rigid actor A.
Prefab parameters for a JointRotationTrackingConstraintParams.
DynamicString actorNameB
Name or hierarchy path identifying rigid actor B.
DynamicString actorNameA
Name or hierarchy path identifying rigid actor A.
bool operator==(JointRotationTrackingConstraintPrefab const &) const =default
Used by ContactFilter to enable or disable contact for a pair of layers.
bool enable
Enable (true) or disable (false) contact for the specified pair of contact layer names.
DynamicArray< DynamicString > layers
Identifies two contact layer names.
bool operator==(LayerContactEntry const &) const =default
Prefab parameters for an articulated pose controller.
DynamicArray< PoseTrackingParams > linkRotTracking
Per-link rotation tracking parameters.
DynamicString articulatedActor
Name or hierarchy path of the articulated actor to control.
DynamicArray< PoseTrackingParams > jointTracking
Per-joint pose tracking parameters.
bool operator==(PoseControllerPrefab const &) const =default
std::optional< DynamicString > comment
Optional serialized comment.
DynamicArray< PoseTrackingParams > linkPosTracking
Per-link position tracking parameters.
Parameters for instantiating a ScenePrefab into a Scene.
Real3 translation
Translation (position) of the new prefab in world-space.
Quaternion rotation
Rotation quaternion [x, y, z, w] of the new prefab in world-space.
real scale
Uniform scale of the new prefab in world-space.
bool applySceneSettings
Whether to apply top-level scene settings.
DynamicString name
Optional name prefix for created actors.
Reference to another prefab (scene or actor) for prefab nesting.
real scale
Uniform scale of the nested prefab, relative to the parent prefab.
std::optional< DynamicString > comment
Optional serialized comment.
Real3 translation
Translation [x, y, z] of the nested prefab in the parent's local space.
bool operator==(PrefabReference const &) const =default
DynamicString path
Path to the nested prefab file.
Quaternion rotation
Rotation quaternion [x, y, z, w] of the nested prefab in the parent's local space.
PrefabHandle prefab
Handle to the loaded nested prefab.
DynamicString name
Name of the nested prefab instance.
Prefab parameters for a rigid actor.
Real3 translation
Actor translation [x, y, z] relative to the prefab's local frame (i.e., the prefab-from-local transla...
Real3 renderModelScale
Scale [x, y, z] to apply to the render model.
Quaternion rotation
Actor rotation quaternion [x, y, z, w] relative to the prefab's local frame (i.e.,...
bool operator==(RigidActorPrefab const &) const =default
Real3 shapeTranslation
Translation [x, y, z] to bake into the shape file.
Real3 renderModelTranslation
Translation [x, y, z] to apply to the render model.
Quaternion renderModelRotation
Rotation quaternion [x, y, z, w] to apply to the render model.
Real3 scale
Scale [x, y, z] to bake into the shape file.
DynamicString shapeFile
Path to a model file that will be loaded and referenced via ShapeHandle.
std::optional< DynamicString > comment
Optional serialized comment.
DynamicString renderModelFile
Optional path to a render model file (e.g.
Quaternion shapeRotation
Rotation quaternion [x, y, z, w] to bake into the shape file.
Prefab parameters for a RigidPivotPositionConstraintParams.
DynamicString actorName
Name or hierarchy path identifying the rigid actor.
bool operator==(RigidPivotPositionConstraintPrefab const &) const =default
Prefab parameters for a RigidPivotRotationConstraintParams.
bool operator==(RigidPivotRotationConstraintPrefab const &) const =default
DynamicString actorName
Name or hierarchy path identifying the rigid actor.
Prefab parameters for a RigidPivotToRigidTargetConstraintParams.
DynamicString actorName
Name or hierarchy path identifying the rigid actor.
bool operator==(RigidPivotToRigidTargetConstraintPrefab const &) const =default
Prefab parameters for a RigidPrismaticJointConstraintParams.
bool operator==(RigidPrismaticJointConstraintPrefab const &) const =default
DynamicString actorNameB
Name or hierarchy path identifying rigid actor B.
DynamicString actorNameA
Name or hierarchy path identifying rigid actor A.
Prefab parameters for a RigidSphericalJointConstraintParams.
bool operator==(RigidSphericalJointConstraintPrefab const &) const =default
DynamicString actorNameA
Name or hierarchy path identifying rigid actor A.
DynamicString actorNameB
Name or hierarchy path identifying rigid actor B.
Parameters that are global to the Scene in which this prefab will be instantiated.
std::optional< Real3 > gravity
Optional gravity vector [m/s^2] in world frame.
std::optional< DynamicString > comment
Optional serialized comment.
DynamicString description
Human-readable description of the scene.
bool operator==(SceneParams const &) const =default
std::optional< SolverParams > solver
Optional solver parameters.
Top-level prefab describing a complete or partial physics scene (possibly just one actor).
std::optional< ContactFilter > contactFilter
Contact filter settings for selective contact filtering.
std::optional< SceneParams > scene
Global scene parameters (top-level prefab only).
bool operator==(ScenePrefab const &) const =default
DynamicArray< PrefabReference > prefabs
List of nested prefab references.
DynamicArray< PoseControllerPrefab > controllers
List of pose controllers.
ActorLists actors
Lists of actors by type.
std::optional< DynamicArray< ContactPairParamsOverrideEntry > > contactPairParamsOverrides
Optional actor-pair contact parameter overrides.
ConstraintLists constraints
Lists of constraints by type.
std::optional< DynamicString > comment
Optional serialized comment.
std::optional< DynamicString > sourceFilePath
Path this prefab was loaded from, exactly as passed to the loading function.
Prefab parameters for a soft actor.
DynamicString renderModelFile
Optional path to a render model file (e.g.
std::optional< DynamicArray< real > > nodeDisplacements
Optional initial nodal displacements in model space, flattened as [x0, y0, z0, x1,...
ShapeHandle flow
[Experimental] Optional deep flow shape handle loaded from flowFile.
Quaternion shapeRotation
Rotation quaternion [x, y, z, w] to bake into the shape file.
DynamicString shapeFile
Path to a model file that will be loaded and referenced via ShapeHandle.
Real3 translation
Actor translation [x, y, z] relative to the prefab's local frame (i.e., the prefab-from-local transla...
bool operator==(SoftActorPrefab const &) const =default
Real3 shapeTranslation
Translation [x, y, z] to bake into the shape file.
Quaternion renderModelRotation
Rotation quaternion [x, y, z, w] to apply to the render model.
bool useRecentering
[Experimental] Enable automatic recentering of the local coordinate system.
Real3 scale
Scale [x, y, z] to bake into the shape file.
GridSdfParams sdf
[Experimental] Parameters used to construct a grid-based Signed Distance Field (SDF) from the shape's...
Real3 renderModelTranslation
Translation [x, y, z] to apply to the render model.
DynamicString flowFile
[Experimental] Optional path to a deep flow shape handle for collision detection.
ColliderType colliderType
[Experimental] Collision detection geometry.
std::optional< DynamicString > comment
Optional serialized comment.
Quaternion rotation
Actor rotation quaternion [x, y, z, w] relative to the prefab's local frame (i.e.,...
Real3 renderModelScale
Scale [x, y, z] to apply to the render model.
Prefab parameters for a soft-skinned actor.
DynamicArray< SoftActorPrefab > softParams
Parameters for each nested soft actor.
ArticulatedActorPrefab skeletonParams
Articulated actor parameters for the skeleton.
bool operator==(SoftSkinnedActorPrefab const &) const =default
bool enableCollidingLinks
Whether links can collide with each other.
bool hasInertia
Whether inertia is applied.
std::optional< DynamicString > comment
Optional serialized comment.
DynamicArray< DynamicString > softAttachLinks
Local link names to attach each nested soft actor to.
bool hasStress
Whether soft material stress is applied.
bool hasGravity
Whether gravity is applied.