Browse Source

Fix Node::GetSignedWorldScale. Related to #1926.

Eugene Kozlov 8 years ago
parent
commit
ef304f6bca
1 changed files with 4 additions and 11 deletions
  1. 4 11
      Source/Urho3D/Scene/Node.cpp

+ 4 - 11
Source/Urho3D/Scene/Node.cpp

@@ -1175,15 +1175,8 @@ Vector3 Node::GetSignedWorldScale() const
 {
 {
     if (dirty_)
     if (dirty_)
         UpdateWorldTransform();
         UpdateWorldTransform();
-    
-    Vector3 scale = worldTransform_.Scale();
-    Matrix3 rot = worldRotation_.RotationMatrix();
-    
-    scale.x_ *= Sign(rot.m00_) * Sign(worldTransform_.m00_);
-    scale.y_ *= Sign(rot.m11_) * Sign(worldTransform_.m11_);
-    scale.z_ *= Sign(rot.m22_) * Sign(worldTransform_.m22_);
-    
-    return scale;
+
+    return worldTransform_.SignedScale(worldRotation_.RotationMatrix());
 }
 }
 
 
 Vector3 Node::LocalToWorld(const Vector3& position) const
 Vector3 Node::LocalToWorld(const Vector3& position) const
@@ -1922,7 +1915,7 @@ Animatable* Node::FindAttributeAnimationTarget(const String& name, String& outNa
         {
         {
             if (names[i].Front() != '#')
             if (names[i].Front() != '#')
                 break;
                 break;
-            
+
             String name = names[i].Substring(1, names[i].Length() - 1);
             String name = names[i].Substring(1, names[i].Length() - 1);
             char s = name.Front();
             char s = name.Front();
             if (s >= '0' && s <= '9')
             if (s >= '0' && s <= '9')
@@ -1934,7 +1927,7 @@ Animatable* Node::FindAttributeAnimationTarget(const String& name, String& outNa
             {
             {
                 node = node->GetChild(name, true);
                 node = node->GetChild(name, true);
             }
             }
-            
+
             if (!node)
             if (!node)
             {
             {
                 URHO3D_LOGERROR("Could not find node by name " + name);
                 URHO3D_LOGERROR("Could not find node by name " + name);