diff options
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_fly.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_walk.c | 14 |
3 files changed, 9 insertions, 31 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 8a11b336fd5..757784cf32a 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1178,12 +1178,6 @@ static void view3d_ndof_pan_zoom(const struct wmNDOFMotionData *ndof, ScrArea *s { RegionView3D *rv3d = ar->regiondata; const float dt = ndof->dt; - - /* tune these until everything feels right */ - const float forward_sensitivity = 1.f; - const float vertical_sensitivity = 0.4f; - const float lateral_sensitivity = 0.6f; - float view_inv[4]; float pan_vec[3]; @@ -1191,9 +1185,9 @@ static void view3d_ndof_pan_zoom(const struct wmNDOFMotionData *ndof, ScrArea *s return; } - pan_vec[0] = lateral_sensitivity * ndof->tvec[0] * ((U.ndof_flag & NDOF_PANX_INVERT_AXIS) ? -1.0f : 1.0f); - pan_vec[1] = vertical_sensitivity * ndof->tvec[1] * ((U.ndof_flag & NDOF_PANZ_INVERT_AXIS) ? -1.0f : 1.0f); - pan_vec[2] = forward_sensitivity * ndof->tvec[2] * ((U.ndof_flag & NDOF_PANY_INVERT_AXIS) ? -1.0f : 1.0f); + pan_vec[0] = ndof->tvec[0] * ((U.ndof_flag & NDOF_PANX_INVERT_AXIS) ? -1.0f : 1.0f); + pan_vec[1] = ndof->tvec[1] * ((U.ndof_flag & NDOF_PANZ_INVERT_AXIS) ? -1.0f : 1.0f); + pan_vec[2] = ndof->tvec[2] * ((U.ndof_flag & NDOF_PANY_INVERT_AXIS) ? -1.0f : 1.0f); if (has_zoom) { /* zoom with Z */ diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 9f8d1e14601..813404a5bf9 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -958,28 +958,20 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) rv3d->rot_angle = 0.0f; /* disable onscreen rotation doo-dad */ if (do_translate) { - const float forward_sensitivity = 1.0f; - const float vertical_sensitivity = 0.4f; - const float lateral_sensitivity = 0.6f; - float speed = 10.0f; /* blender units per second */ + float trans[3]; /* ^^ this is ok for default cube scene, but should scale with.. something */ - - float trans[3] = {lateral_sensitivity * ndof->tvec[0], - vertical_sensitivity * ndof->tvec[1], - forward_sensitivity * ndof->tvec[2]}; - if (fly->use_precision) speed *= 0.2f; - mul_v3_fl(trans, speed * dt); + mul_v3_v3fl(trans, ndof->tvec, speed * dt); /* transform motion from view to world coordinates */ mul_qt_v3(view_inv, trans); if (flag & NDOF_FLY_HELICOPTER) { /* replace world z component with device y (yes it makes sense) */ - trans[2] = speed * dt * vertical_sensitivity * ndof->tvec[1]; + trans[2] = speed * dt * ndof->tvec[1]; } if (rv3d->persp == RV3D_CAMOB) { diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index e65cd3cb7e4..426a9a69f07 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -1238,28 +1238,20 @@ static int walkApply_ndof(bContext *C, WalkInfo *walk) rv3d->rot_angle = 0.0f; /* disable onscreen rotation doo-dad */ if (do_translate) { - const float forward_sensitivity = 1.0f; - const float vertical_sensitivity = 0.4f; - const float lateral_sensitivity = 0.6f; - float speed = 10.0f; /* blender units per second */ + float trans[3]; /* ^^ this is ok for default cube scene, but should scale with.. something */ - - float trans[3] = {lateral_sensitivity * ndof->tvec[0], - vertical_sensitivity * ndof->tvec[1], - forward_sensitivity * ndof->tvec[2]}; - if (walk->is_slow) speed *= 0.2f; - mul_v3_fl(trans, speed * dt); + mul_v3_v3fl(trans, ndof->tvec, speed * dt); /* transform motion from view to world coordinates */ mul_qt_v3(view_inv, trans); if (flag & NDOF_FLY_HELICOPTER) { /* replace world z component with device y (yes it makes sense) */ - trans[2] = speed * dt * vertical_sensitivity * ndof->tvec[1]; + trans[2] = speed * dt * ndof->tvec[1]; } if (rv3d->persp == RV3D_CAMOB) { |