Skip to content

Class: SyncedQuaternion ​

Defined in: packages/core/src/transform/synced-quaternion.ts:21

Quaternion whose internal _x/_y/_z/_w are backed by a Float32Array.

Remarks ​

  • Three.js quaternion math reads/writes the internal fields; by replacing those with array‑backed accessors, all operations become zero‑copy against the ECS component buffer.
  • When no target is set, it behaves like a normal Quaternion.

Extends ​

  • Quaternion

Constructors ​

Constructor ​

new SyncedQuaternion(x, y, z, w): SyncedQuaternion

Defined in: packages/core/src/transform/synced-quaternion.ts:30

Parameters ​

x ​

number = 0

y ​

number = 0

z ​

number = 0

w ​

number = 1

Returns ​

SyncedQuaternion

Overrides ​

Quaternion.constructor

Methods ​

_onChangeWithSuppression() ​

_onChangeWithSuppression(callback): void

Defined in: packages/core/src/transform/synced-quaternion.ts:142

Register a callback that will be called when quaternion changes from external sources. The callback is suppressed when changes originate from rotation to prevent loops.

Parameters ​

callback ​

() => void

Returns ​

void


_withSuppressedOnChange() ​

_withSuppressedOnChange(fn): void

Defined in: packages/core/src/transform/synced-quaternion.ts:154

Temporarily suppress onChange callbacks while executing a function. Used when rotation updates quaternion to prevent circular updates.

Parameters ​

fn ​

() => void

Returns ​

void


setTarget() ​

setTarget(target, offset): this

Defined in: packages/core/src/transform/synced-quaternion.ts:132

Bind this quaternion to a packed float array.

Parameters ​

target ​

Float32Array

Float32Array to read/write (xyzw at consecutive indices).

offset ​

number = 0

Starting index within the array (x at offset).

Returns ​

this

Privacy | Terms