Fix WMO doodad rotation: remove incorrect quaternion X/Y swap

The glm::quat(w,x,y,z) constructor was receiving swapped X/Y components,
causing doodads like the Deeprun Tram gears to be oriented horizontally
instead of vertically. Also use createInstanceWithMatrix for instance WMO
doodads to preserve full rotation from the quaternion.
This commit is contained in:
Kelsi 2026-03-06 18:48:12 -08:00
parent 8b0c2a0fa1
commit 7630c7aec7
2 changed files with 4 additions and 5 deletions

View file

@ -3712,8 +3712,8 @@ void Application::loadOnlineWorldTerrain(uint32_t mapId, float x, float y, float
}
if (!m2Model.isValid()) continue;
glm::quat fixedRotation(doodad.rotation.w, doodad.rotation.y,
doodad.rotation.x, doodad.rotation.z);
glm::quat fixedRotation(doodad.rotation.w, doodad.rotation.x,
doodad.rotation.y, doodad.rotation.z);
glm::mat4 doodadLocal(1.0f);
doodadLocal = glm::translate(doodadLocal, doodad.position);
doodadLocal *= glm::mat4_cast(fixedRotation);
@ -3724,7 +3724,7 @@ void Application::loadOnlineWorldTerrain(uint32_t mapId, float x, float y, float
uint32_t doodadModelId = static_cast<uint32_t>(std::hash<std::string>{}(m2Path));
m2Renderer->loadModel(m2Model, doodadModelId);
uint32_t doodadInstId = m2Renderer->createInstance(doodadModelId, worldPos, glm::vec3(0.0f), doodad.scale);
uint32_t doodadInstId = m2Renderer->createInstanceWithMatrix(doodadModelId, worldMatrix, worldPos);
if (doodadInstId) m2Renderer->setSkipCollision(doodadInstId, true);
loadedDoodads++;
}