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
This commit is contained in:
parent
dc09cc13ea
commit
a0bbd65d57
Notes:
blender-bot
2023-02-14 01:53:49 +01:00
Referenced by issue #66713, Walk Teleport and other movements do not take into account the unit scale of the Scene
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue