ecere/3D gfx/Camera: Fixed 'attached' (euler) orientation issues
authorJerome St-Louis <jerome@ecere.com>
Wed, 2 Apr 2014 04:01:33 +0000 (00:01 -0400)
committerJerome St-Louis <jerome@ecere.com>
Wed, 2 Apr 2014 04:01:33 +0000 (00:01 -0400)
- This was breaking the 'orbitWithMouse' sample

ecere/src/gfx/3D/Camera.ec
ecere/src/gfx/3D/Object.ec

index 7622986..0e0c82c 100644 (file)
@@ -164,8 +164,10 @@ public:
                if(target)
                {
                   Euler eulerCamera = orientation, euler;
+                  Euler eulerTarget = this.target.transform.orientation;
+                  // Cannot rely on 'this.target.eulerOrientation' as it is only updated when calling Rotate()
 
-                  euler.Add(eulerCamera, this.target.eulerOrientation);
+                  euler.Add(eulerCamera, eulerTarget);
 
                   // Logf("yaw = %f, pitch = %f\n", eulerCamera.yaw, eulerCamera.pitch);
 
index 73855dd..4bad63e 100644 (file)
@@ -1084,6 +1084,7 @@ public:
 
    void RotateEuler(Euler rotation, Euler min, Euler max)
    {
+      // WARNING: 'eulerOrientation' is only updated by this function
       Euler euler = eulerOrientation;//transform.orientation;
       euler.Add(euler, rotation);