# world.setQuaternion doesn't set the world rotation

**URL:** <https://forum.8thwall.com/t/world-setquaternion-doesnt-set-the-world-rotation/7283>\
**Category:** Studio Feedback\
**Created:** [June 26, 2025, 11:34pm UTC](https://forum.8thwall.com/t/world-setquaternion-doesnt-set-the-world-rotation/7283 "2025-06-26T23:34:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens\_Zalzala](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/jens_zalzala/32/2416_2.png) [@Jens\_Zalzala](https://forum.8thwall.com/u/Jens_Zalzala)\
**Post date:** [June 26, 2025, 11:34pm UTC](https://forum.8thwall.com/t/world-setquaternion-doesnt-set-the-world-rotation/7283/1 "2025-06-26T23:34:47Z")

</div>

world.setQuaternion seems to set the local rotation.

To reproduce:

1. Create 2 objects.
2. Create a parent for one of the objects and set a rotation on the parent
3. Use world.setQuaternion to set the same quaternion on both objects  
Observe that their rotations are different.

Maybe this is intended, but it seems like a bug.  
Is there some way to set the rotation in world space? I’m trying to match the rotation of 2 objects, but so far I’ve been unable to do so.

Transforms in general seem unnecessarily confusing/messy. Why do we have functions in world, and in world.transform? Why can’t I get the rotation of an object? Why does setQuaternion not accept a quaternion, instead requiring the individual x,y,z,w values?

---

<div class="post-metadata">

**Author:** ![Christoph\_Bartschat](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Christoph\_Bartschat](https://forum.8thwall.com/u/Christoph_Bartschat)\
**Post date:** [July 1, 2025, 5:53pm UTC](https://forum.8thwall.com/t/world-setquaternion-doesnt-set-the-world-rotation/7283/2 "2025-07-01T17:53:36Z")

</div>

Hi Jens,

Apologies for the confusion.

The `Position`/`Scale`/`Quaternion` components represent the local transform relative to the parent. They expose the same get/set/reset/etc API as all other components.

`world.setQuaternion` is a convenience method for `Quaternion.set(world, ...)` (not very useful at this point admittedly).

`world.transform` builds on top of the APIs exposed directly by `world`, handling the more complex logic, but we may simplify this in a major update when we get the opportunity.

Our initial set of functions implemented in `world.transform` were based on what we had specific use cases already in mind for, but sounds like a `world.transform.get/setWorldQuaternion` would be a welcome addition.

In the meantime, `world.transform.get/setWorldTransform` are already available which enable any sort of modifications necessary to the world transform, like:

```ts
// Reusing objects to avoid runtime allocations (optional)
const TEMP_MATRIX = mat4.i()
const TEMP_TRS = {
  t: vec3.zero(),
  r: quat.zero(),
  s: vec3.zero(),
}
const setWorldQuaternion = (world: World, eid: Eid, quaternion: Quat) => {
  world.transform.getWorldTransform(eid, TEMP_MATRIX)
  TEMP_MATRIX.decomposeTrs(TEMP_TRS)
  TEMP_MATRIX.makeTrs(TEMP_TRS.t, quaternion, TEMP_TRS.s)
  world.transform.setWorldTransform(eid, TEMP_MATRIX)
}

```
