[Bf-blender-cvs] [a0bbd65d57f] master: Fix T66713: Walk mode doesn't take scene unit scale into account

Campbell Barton noreply at git.blender.org
Fri Oct 21 07:17:45 CEST 2022


Commit: a0bbd65d57f38344fb71565c3c34396363a4be23
Author: Campbell Barton
Date:   Fri Oct 21 16:11:07 2022 +1100
Branches: master
https://developer.blender.org/rBa0bbd65d57f38344fb71565c3c34396363a4be23

Fix T66713: Walk mode doesn't take scene unit scale into account

When changing a scene's unit scale from 1 to something else, 0.1 for
e.g. walk navigation no longer worked properly. Whenever gravity is
enabled, and the user starts to fall or jump, the view-port glitched out
into low earth orbit.

Reviewed By: campbellbarton

Ref D16277

===================================================================

M	source/blender/editors/space_view3d/view3d_navigate_walk.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_navigate_walk.c b/source/blender/editors/space_view3d/view3d_navigate_walk.c
index aea322d73d9..fcb4f549353 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_walk.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_walk.c
@@ -1231,11 +1231,11 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm)
         /* keep moving if we were moving */
         copy_v2_v2(dvec, walk->teleport.direction);
 
-        z_cur = walk->rv3d->viewinv[3][2];
-        z_new = walk->teleport.origin[2] - getFreeFallDistance(walk->gravity, t) * walk->grid;
+        z_cur = walk->rv3d->viewinv[3][2] / walk->grid;
+        z_new = (walk->teleport.origin[2] / walk->grid) - getFreeFallDistance(walk->gravity, t);
 
         /* jump */
-        z_new += t * walk->speed_jump * walk->grid;
+        z_new += t * walk->speed_jump;
 
         /* duration is the jump duration */
         if (t > walk->teleport.duration) {



More information about the Bf-blender-cvs mailing list