1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-10 04:42:38 +01:00

Improve animation interpolation

This commit is contained in:
Daniel Evans 2014-12-13 00:59:23 +00:00
parent b444e0da04
commit 13192c8524
2 changed files with 6 additions and 5 deletions

View File

@ -288,9 +288,10 @@ void VehicleObject::tickPhysics(float dt)
auto rot = it.second.body->getWorldTransform().getRotation();
auto r2 = inv * glm::quat(rot.w(), rot.x(), rot.y(), rot.z());
auto ldata = skeleton->getData(it.first->getIndex()).a;
ldata.rotation = r2;
skeleton->setData(it.first->getIndex(), { ldata, ldata, true } );
auto& prev = skeleton->getData(it.first->getIndex()).a;
auto next = prev;
next.rotation = r2;
skeleton->setData(it.first->getIndex(), { next, prev, true } );
}
}
}

View File

@ -465,10 +465,10 @@ void GameRenderer::renderPedestrian(CharacterObject *pedestrian)
if(!pedestrian->model->model) return;
// Apply the inverse of the root transform from the current animation.
if( pedestrian->isAnimationFixed() )
{
auto rtranslate = pedestrian->animator->getTimeTranslation(_renderAlpha);
// Apply the inverse of the root transform from the current animation.
auto rtranslate = pedestrian->skeleton->getInterpolated(1).translation;
matrixModel = glm::translate(matrixModel, -rtranslate);
}