Fixed BoneAttachment offset rotation

This commit is contained in:
viktorljung
2016-03-08 14:32:50 +01:00
parent f77a610519
commit 8d1877321a
6 changed files with 193 additions and 41 deletions
-2
View File
@@ -127,7 +127,6 @@ void AnimationSystem::UpdateAnimations(double dt)
void AnimationSystem::UpdateWeights(double dt)
{
for (auto it = m_AutoBlendQueues.begin(); it != m_AutoBlendQueues.end(); ) {
it->second.PrintQueue();
if(it->second.HasActiveBlendJob()) {
AutoBlendQueue::AutoBlendJob& blendJob = it->second.GetActiveBlendJob();
@@ -152,7 +151,6 @@ void AnimationSystem::UpdateWeights(double dt)
}
}
}
LOG_INFO("");
}
bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
@@ -49,14 +49,19 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
glm::vec3 skew;
glm::vec4 perspective;
glm::decompose(boneTransform, scale, rotation, translation, skew, perspective);
glm::vec3 angles = glm::vec3(-glm::pitch(rotation), -glm::yaw(rotation), -glm::roll(rotation));
rotation = rotation * glm::quat((glm::vec3)entity["BoneAttachment"]["OrientationOffset"]);
rotation.w = -rotation.w;
glm::vec3 angles = glm::eulerAngles(rotation);
if ((bool)entity["BoneAttachment"]["InheritPosition"]) {
(glm::vec3&)entity["Transform"]["Position"] = translation + (glm::vec3)entity["BoneAttachment"]["PositionOffset"];
}
if ((bool)entity["BoneAttachment"]["InheritOrientation"]) {
(glm::vec3&)entity["Transform"]["Orientation"] = angles + (glm::vec3)entity["BoneAttachment"]["OrientationOffset"];
(glm::vec3&)entity["Transform"]["Orientation"] = angles;
}
if ((bool)entity["BoneAttachment"]["InheritScale"]) {
(glm::vec3&)entity["Transform"]["Scale"] = scale * (glm::vec3)entity["BoneAttachment"]["ScaleOffset"];