Skip to main content
Version: 3.5.x

Basis Permutation

The basis maps between Haply's internal coordinate system and your application's.

Haply default frame​

Haply uses a right-handed coordinate system:

AxisDirection
+XRight
+YForward
+ZUp

How it works​

A permutation string tells the service how your application's axes map to Haply's. Once set, every value the service returns (positions, velocities, forces, orientations) is expressed in your basis, and every value you send is interpreted in your basis. The conversion is automatic and bidirectional.

The string is a permutation of X, Y, Z, optionally prefixed by + or - to negate an axis.

Examples​

PermutationMeaningTypical use
XYZIdentity — no remappingHaply-native apps
XZYSwap Y and Z → your +Y is upY-up engines
X-YZNegate Y → left-handed Z-upUnreal Engine
ZXYCycle all three axesCustom frame

Interpretation​

"YZX" means:

  • Your X axis = Haply's Y (forward)
  • Your Y axis = Haply's Z (up)
  • Your Z axis = Haply's X (right)

Setting the basis​

The basis is a per-device setting: send it in the configure map of each device you use, Inverse3 and Verse Grips alike. A device keeps its basis until it is changed or the session ends.

{
"inverse3": [
{ "device_id": "049D", "configure": { "basis": { "permutation": "XZY" } } }
],
"wireless_verse_grip": [
{ "device_id": "1798", "configure": { "basis": { "permutation": "XZY" } } }
]
}

A device that joins the session later (a Verse Grip switched on or woken up after you connected, a device plugged in mid-session) starts with the identity basis XYZ: send it its configure.basis when it appears, on the device-connected event or when a new device id shows up in the state.

Read config.basis in a full state to see the basis each device actually uses.

Same basis for every device: session.configure.basis​

session.configure.basis is a shortcut: it writes the same basis on every device the session holds when the message arrives.

{
"session": {
"configure": {
"basis": { "permutation": "XZY" }
}
}
}
A shortcut, not a setting for the devices to come

session.configure.basis is not stored on the session. A device that joins afterwards (a Verse Grip switched on or woken up after you connected, a device plugged in mid-session) does not get it and starts with the identity basis XYZ: send that device its own configure.basis when it appears, on the device-connected event. The shortcut also overwrites every per-device basis sent before it.

Migrating from session.set_basis​

The legacy session.set_basis read the permutation the other way round. The same string can therefore mean a different mapping under session.configure.basis: the new permutation is the inverse of the old one.

To convert, take each entry of the old string: the entry at position i holding axis A (with its sign) becomes, at A's position in the new string, the axis of position i with the same sign. For X-ZY: X stays first, the -Z in second (Y) position becomes -Y in third (Z) position, and the Y in third (Z) position becomes Z in second (Y) position: XZ-Y.

Old session.set_basisNew session.configure.basis
X-ZYXZ-Y
XZ-YX-ZY
ZXYYZX
YZXZXY
-ZXYYZ-X
Y-XZ-YXZ

Identity, plain axis swaps and plain sign flips (XYZ, XZY, ZYX, X-YZ) are their own inverse: they keep the same string. Negating signs alone is not a general rule: ZXY becomes YZX with no sign at all.