SuperDex Physics C++ API
Loading...
Searching...
No Matches
superdex::prefab::PrefabParams Struct Reference

Parameters for instantiating a ScenePrefab into a Scene. More...

#include <mochi_prefab.h>

Public Attributes

bool applySceneSettings = true
 Whether to apply top-level scene settings.
DynamicString name {}
 Optional name prefix for created actors.
Quaternion rotation {}
 Rotation quaternion [x, y, z, w] of the new prefab in world-space.
real scale = 1_r
 Uniform scale of the new prefab in world-space.
Real3 translation {}
 Translation (position) of the new prefab in world-space.

Detailed Description

Parameters for instantiating a ScenePrefab into a Scene.

Definition at line 330 of file mochi_prefab.h.

Member Data Documentation

◆ applySceneSettings

bool superdex::prefab::PrefabParams::applySceneSettings = true

Whether to apply top-level scene settings.

When true, AddToScene applies gravity and solver overrides from the SceneParams of the top-level prefab. Omitted overrides preserve existing scene values. When false, neither override is applied. Scene settings from nested prefabs are always ignored.

Definition at line 335 of file mochi_prefab.h.

◆ name

DynamicString superdex::prefab::PrefabParams::name {}

Optional name prefix for created actors.

Actor names are formatted based on their hierarchy paths. If this string is not empty, it will be used as the first token in the path ("prefabName/actorName", "prefabName/nestedPrefabName/actorName", etc.)

Definition at line 331 of file mochi_prefab.h.

◆ rotation

Quaternion superdex::prefab::PrefabParams::rotation {}

Rotation quaternion [x, y, z, w] of the new prefab in world-space.

Note
Must be finite and non-zero.

Definition at line 333 of file mochi_prefab.h.

◆ scale

real superdex::prefab::PrefabParams::scale = 1_r

Uniform scale of the new prefab in world-space.

Composes multiplicatively with any nested PrefabReference::scale and any per-actor scale (e.g. ArticulatedActorPrefab::scale) to give the cumulative "effective scale" baked into each actor when the prefab is instantiated.

The effective scale is applied to:

The mass and moment of inertia formulas preserve the user's authored density.

The effective scale is NOT applied to:

  • density (intrinsic material property; mass/density are mutually exclusive in the prefab API, so no double-application)
  • linearVelocity / angularVelocity / jointVelocities
  • Constraint stiffness/damping coefficients and saturation thresholds inherited from ConstraintParams. These parameters define the constraint's response, not just geometry: different goals (preserving material behavior, damping ratio, actuator limits, or closed-loop response) imply different scale laws, so prefab scaling preserves authored values.
  • Joint inertia, friction, limit stiffness/damping, cycle joint stiffness (characterized actuator / tuned-penalty parameters; bring your own actuator model when scaling a robot)
  • Revolute and spherical joint angular limits, rotation-valued targets and ranges in Articulated3dRotationTargetConstraintPrefab and Articulated3dRotationRangeConstraintPrefab, and rotational single-DoF target/range values in ArticulatedSingleDofTargetConstraintPrefab and ArticulatedSingleDofRangeConstraintPrefab (scale invariant)
Note
Must be strictly positive and finite. Negative or zero scale is invalid and rejected at AddToScene. The ScenePrefab overload additionally requires scale == 1; use the file-path AddToScene overload, nested PrefabReference::scale, or per-actor scale for non-identity scaling.
Authoring with RigidActorParams::mass = M is equivalent to authoring with the implied density M / V_unit; under prefab scale the density is preserved and mass scales with the absolute volume scale, so the result is "the same material at a bigger size." For a purely uniform effective scale s, this mass factor is s^3. If you need a fixed mass that does NOT scale with the prefab, set the mass at runtime via Actor::SetDensity after the actor is instantiated.

Definition at line 332 of file mochi_prefab.h.

◆ translation

Real3 superdex::prefab::PrefabParams::translation {}

Translation (position) of the new prefab in world-space.

Note
Must be finite.

Definition at line 334 of file mochi_prefab.h.


The documentation for this struct was generated from the following files: