QVector3D maths in QML
I have the following piece of code:
var direction = cam.eye - cam.center;
cam.eye += direction * length;
cam.center += direction * length;
cam is a Camera object (from Qt3D), and thus cam.eye and cam.center are vector3d's.
The piece of code is supposed to move the eye (user) towards the center point, and also moving the center point, so that we don't get errors when reaching it.
length specifies the length to move.
The problem is I get the following error for line 3 in the above code:
@Error: Cannot assign QString to QVector3D@
I am not to confident with QML yet, so it probably is something very simple.
For QtQuick 2.0 a number of functions have been added (see https://qt.gitorious.org/qt/qtdeclarative/commit/42f9444e983b5257241c17242471ca63f208c3f6 for details) to handle this. For QtQuick 1.x you may need to manipulate the sub-values directly (or Qt3D may provide more convenient ways of handling this, I'm not sure).