using the viewmatrix to position the camera could be problematic if the view wasn...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 13 May 2011 18:32:27 +0000 (18:32 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 13 May 2011 18:32:27 +0000 (18:32 +0000)
source/blender/editors/space_view3d/view3d_view.c

index 8c651e465e1ea5646cdb0fdc23e119d14c65ec1a..a58720034bdc67b191ffd2218c884e928fc725d5 100644 (file)
@@ -398,10 +398,14 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot)
 
 void view3d_to_ob(RegionView3D *rv3d, Object *ob)
 {
-       float dvec[3];
        float mat3[3][3];
+       float iviewquat[4];
+       float dvec[3]= {0.0f, 0.0f, rv3d->dist};
+
+       invert_qt_qt(iviewquat, rv3d->viewquat);
+       normalize_qt(iviewquat);
+       mul_qt_v3(iviewquat, dvec);
 
-       mul_v3_v3fl(dvec, rv3d->viewinv[2], rv3d->dist);
        sub_v3_v3v3(ob->loc, dvec, rv3d->ofs);
        rv3d->viewquat[0]= -rv3d->viewquat[0];