mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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:
parent
8b0c2a0fa1
commit
7630c7aec7
2 changed files with 4 additions and 5 deletions
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -567,8 +567,7 @@ std::shared_ptr<PendingTile> TerrainManager::prepareTile(int x, int y) {
|
|||
|
||||
// Build doodad's local transform (WoW coordinates)
|
||||
// WMO doodads use quaternion rotation
|
||||
// Fix: WoW quaternions need X/Y swap for correct orientation
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue