mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Freeze gameobject M2 animations to prevent cycling
Gameobject M2 instances (books, crates, chests) were continuously cycling their animations because M2Renderer unconditionally loops all sequences. Added setInstanceAnimationFrozen() and freeze all gameobject instances at creation time so they stay in their bind pose.
This commit is contained in:
parent
a58115041f
commit
58681753e5
3 changed files with 14 additions and 0 deletions
|
|
@ -3074,6 +3074,16 @@ void M2Renderer::setInstancePosition(uint32_t instanceId, const glm::vec3& posit
|
|||
spatialIndexDirty_ = true;
|
||||
}
|
||||
|
||||
void M2Renderer::setInstanceAnimationFrozen(uint32_t instanceId, bool frozen) {
|
||||
auto idxIt = instanceIndexById.find(instanceId);
|
||||
if (idxIt == instanceIndexById.end()) return;
|
||||
auto& inst = instances[idxIt->second];
|
||||
inst.animSpeed = frozen ? 0.0f : 1.0f;
|
||||
if (frozen) {
|
||||
inst.animTime = 0.0f; // Reset to bind pose
|
||||
}
|
||||
}
|
||||
|
||||
void M2Renderer::setInstanceTransform(uint32_t instanceId, const glm::mat4& transform) {
|
||||
auto idxIt = instanceIndexById.find(instanceId);
|
||||
if (idxIt == instanceIndexById.end()) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue