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:
| Axis | Direction |
|---|---|
| +X | Right |
| +Y | Forward |
| +Z | Up |
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
| Permutation | Meaning | Typical use |
|---|---|---|
XYZ | Identity — no remapping | Haply-native apps |
XZY | Swap Y and Z → your +Y is up | Y-up engines |
X-YZ | Negate Y → left-handed Z-up | Unreal Engine |
ZXY | Cycle all three axes | Custom 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.
- WebSocket
- HTTP
{
"inverse3": [
{ "device_id": "049D", "configure": { "basis": { "permutation": "XZY" } } }
],
"wireless_verse_grip": [
{ "device_id": "1798", "configure": { "basis": { "permutation": "XZY" } } }
]
}
One request per device (see Device selector syntax).
curl -X POST "http://localhost:10001/inverse3/049D/config/basis?session=:0" \
-H "Content-Type: application/json" \
-d '{"permutation": "XZY"}'
curl -X POST "http://localhost:10001/wireless_verse_grip/1798/config/basis?session=:0" \
-H "Content-Type: application/json" \
-d '{"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.
- WebSocket
- HTTP
{
"session": {
"configure": {
"basis": { "permutation": "XZY" }
}
}
}
HTTP has no session-wide basis: a POST names one device (a wildcard selector
is refused as ambiguous). Send the same basis to each device present:
for device in inverse3/049D wireless_verse_grip/1798; do
curl -X POST "http://localhost:10001/$device/config/basis?session=:0" \
-H "Content-Type: application/json" \
-d '{"permutation": "XZY"}'
done
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_basis | New session.configure.basis |
|---|---|
X-ZY | XZ-Y |
XZ-Y | X-ZY |
ZXY | YZX |
YZX | ZXY |
-ZXY | YZ-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.