MjOrientationUtils¶
If true, angles (euler, axisangle) are in degrees. If false (default), radians.
bool bAngleInDegrees = false;
/ Euler rotation sequence, e.g. "xyz", "XYZ", "zyx". Default "xyz" (intrinsic). */
FString EulerSeq = TEXT("xyz");
/ Base directory for mesh file paths (from meshdir attribute). Empty = same dir as XML. /
FString MeshDir;
/ Base directory for all asset paths (from assetdir attribute). Overrides meshdir for meshes if both present. /
FString AssetDir;
/ If true, joints/tendons with a range attribute are automatically treated as limited (from autolimits). */
bool bAutoLimits = false;
/ Helper: resolve a relative mesh path using MeshDir / AssetDir with the given XML directory as the root. /
FString ResolveMeshPath(const FString& RelPath, const FString& XmlDir) const
{
if (RelPath.IsEmpty()) return RelPath;
// AssetDir takes priority for mesh lookups
FString Base = AssetDir.IsEmpty() ? MeshDir : AssetDir;
if (Base.IsEmpty()) Base = XmlDir;
return FPaths::Combine(Base, RelPath);
}
};
/*
Centralized utility for converting MuJoCo orientation attributes to quaternions.
MuJoCo supports 5 orientation representations on spatial-frame elements:
quat, axisangle, euler, xyaxes, zaxis
Only one should be specified per element. Priority order (matching MuJoCo):
quat > axisangle > euler > xyaxes > zaxis
All functions produce MuJoCo-frame quaternions (w, x, y, z).
Use MjUtils::MjToUERotation() to convert to Unreal frame afterwards.
| Attribute | Value |
|---|---|
| Kind | Class |
Properties¶
Public Properties¶
| Property | Type | Description |
|---|---|---|
Lowercase |
* |
Lowercase¶
- Type: *
Private Properties¶
| Property | Type | Description |
|---|---|---|
Result |
** Multiply two quaternions: |
Result¶
- Type: ** Multiply two quaternions:
Functions¶
Public Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
ParseCompilerSettings() |
FMjCompilerSettings | Parse the |
OrientationToMjQuat() |
bool |
Read orientation attributes from an XML element and convert to a MuJoCo-frame quaternion. |
AxisAngleToQuat() |
void | Convert axis-angle (x, y, z, angle_rad) to quaternion. Axis need not be normalized. |
EulerToQuat() |
void | Convert Euler angles to quaternion given a 3-character euler sequence string. |
XYAxesToQuat() |
void | Convert xyaxes (6 values: x-axis 3, y-axis 3) to quaternion. Y is orthogonalized. |
ZAxisToQuat() |
void | Convert zaxis (3 values) to quaternion via minimal rotation from (0,0,1). |
ParseCompilerSettings¶
Parse the
element from an MJCF XML root and extract orientation-related settings.
- Signature:
ParseCompilerSettings(const FXmlNode*RootNode) - Returns: FMjCompilerSettings
OrientationToMjQuat¶
Read orientation attributes from an XML element and convert to a MuJoCo-frame quaternion.
- Signature:
OrientationToMjQuat(const FXmlNode*Node, const FMjCompilerSettings& Settings,doubleOutQuat[4]) - Returns: bool
AxisAngleToQuat¶
Convert axis-angle (x, y, z, angle_rad) to quaternion. Axis need not be normalized.
- Signature:
AxisAngleToQuat(doublex,doubley,doublez,doubleAngleRad,doubleOutQuat[4])
EulerToQuat¶
Convert Euler angles to quaternion given a 3-character euler sequence string.
- Signature:
EulerToQuat(doublee1,doublee2,doublee3,const FString&EulerSeq,doubleOutQuat[4])
XYAxesToQuat¶
Convert xyaxes (6 values: x-axis 3, y-axis 3) to quaternion. Y is orthogonalized.
- Signature:
XYAxesToQuat(const doubleXYAxes[6],doubleOutQuat[4])
ZAxisToQuat¶
Convert zaxis (3 values) to quaternion via minimal rotation from (0,0,1).
- Signature:
ZAxisToQuat(const doubleZAxis[3],doubleOutQuat[4])
Private Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
ElementalRotQuat() |
void | Create a quaternion for rotation around a single axis (0=x, 1=y, 2=z) by AngleRad. |
QuatMul() |
void | Multiply two quaternions: Result = A * B (Hamilton product). All in w,x,y,z order. |
QuatNormalize() |
void | Normalize a quaternion in-place. |
RotMatToQuat() |
void | Convert a 3x3 rotation matrix (row-major) to quaternion (w,x,y,z). |
ElementalRotQuat¶
Create a quaternion for rotation around a single axis (0=x, 1=y, 2=z) by AngleRad.
- Signature:
ElementalRotQuat(intAxisIndex,doubleAngleRad,doubleOutQuat[4])
QuatMul¶
Multiply two quaternions: Result = A * B (Hamilton product). All in w,x,y,z order.
- Signature:
QuatMul(const doubleA[4],const doubleB[4],doubleResult[4])
RotMatToQuat¶
Convert a 3x3 rotation matrix (row-major) to quaternion (w,x,y,z).
- Signature:
RotMatToQuat(const doubleR[9],doubleOutQuat[4])