Просмотр исходного кода

Merge pull request #636 from kwhatmough/next

Adds new forms test and fixes some framework bugs in Forms.cpp
Sean Paul Taylor 13 лет назад
Родитель
Сommit
eef1def90b
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      gameplay/src/Form.cpp

+ 4 - 4
gameplay/src/Form.cpp

@@ -711,12 +711,12 @@ bool Form::projectPoint(int x, int y, Vector3* point)
 {
     Scene* scene = _node->getScene();
     GP_ASSERT(scene);
-    Camera* camera = scene->getActiveCamera();
+    Camera* camera;
 
-    if (camera)
+    if (scene && (camera = scene->getActiveCamera()))
     {
         // Get info about the form's position.
-        Matrix m = _node->getMatrix();
+        Matrix m = _node->getWorldMatrix();
         Vector3 min(0, 0, 0);
         m.transformPoint(&min);
 
@@ -731,7 +731,7 @@ bool Form::projectPoint(int x, int y, Vector3* point)
         // by the quad's forward vector and one of its points to the plane defined by the same vector and the origin.
         const float& a = normal.x; const float& b = normal.y; const float& c = normal.z;
         const float d = -(a*min.x) - (b*min.y) - (c*min.z);
-        const float distance = abs(d) /  sqrt(a*a + b*b + c*c);
+        const float distance = fabs(d) /  sqrt(a*a + b*b + c*c);
         Plane plane(normal, -distance);
 
         // Check for collision with plane.