Walk Teleport and other movements do not take into account the unit scale of the Scene #66713

Closed
opened 2019-07-11 17:26:48 +02:00 by Vyacheslav Kobozev · 14 comments

System Information
Operating system: Windows-7-6.1.7601-SP1 64 Bits
Graphics card: GeForce GTX 660 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.86

Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-10 23:46, hash: 676543d91f

Short description of error
If you set Unit scale (scene) 0.1, Walk teleport (Space button in walk mode) jumps to empty nowhere
2019-07-11_18-22-54.mp4

walk to void.blend

**System Information** Operating system: Windows-7-6.1.7601-SP1 64 Bits Graphics card: GeForce GTX 660 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.86 **Blender Version** Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-10 23:46, hash: `676543d91f` **Short description of error** If you set Unit scale (scene) 0.1, Walk teleport (Space button in walk mode) jumps to empty nowhere [2019-07-11_18-22-54.mp4](https://archive.blender.org/developer/F7593454/2019-07-11_18-22-54.mp4) [walk to void.blend](https://archive.blender.org/developer/F7593467/walk_to_void.blend)

Added subscriber: @Vyach

Added subscriber: @Vyach

#69934 was marked as duplicate of this issue

#69934 was marked as duplicate of this issue

Added subscriber: @enrivector

Added subscriber: @enrivector

Same here

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 1060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.86

Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-11 11:00, hash: d663048696
Worked: (optional)

Same here **System Information** Operating system: Windows-10-10.0.18362 64 Bits Graphics card: GeForce GTX 1060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.86 **Blender Version** Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-11 11:00, hash: `d663048696` Worked: (optional)
Sebastian Parborg self-assigned this 2019-07-12 11:38:03 +02:00
Sebastian Parborg was unassigned by Dalai Felinto 2019-12-23 16:33:49 +01:00

Added subscriber: @ZedDB

Added subscriber: @ZedDB
Bastien Montagne changed title from Walk Teleport breaks navigation with 0.1 units scale to Walk Teleport and other movements do not take into account the unit scale of the Scene 2020-01-27 17:03:46 +01:00
Member

Added subscriber: @Poulpator

Added subscriber: @Poulpator
Member

Duplicate from #69934

Duplicate from #69934

Those one reported later, but yes, should be merged.

Those one reported later, but yes, should be merged.
Member
Added subscribers: @AlbertoVelazquez, @brecht, @lichtwerk, @JacquesLucke, @WilliamReynish

Added subscriber: @crashlog

Added subscriber: @crashlog

I've found that this is due to the walk navigation incorrectly taking the unit scale into account, in the part where gravity, falling and jumping are handled. In fact, the unit scale is taken into account twice, resulting in the weird behavior.

The falling part works as follows:

  • When we start to fall, the current viewport position (walk->rv3d->viewinv) is stored (walk->teleport.origin)
  • During every frame after this, the origin is taken, and a distance is subtracted based on the time since falling start and gravity, to simulate acceleration (z_new)
  • Because we need a delta and not an absolute value, the delta between the newly calculated z-value and the current z-value is taken (z_cur - z_new)
  • The delta is then set on the dvec vector
  • Later on, the dvec is scaled according to the unit scale
  • This overshoots the fall distance, which is compensated by the next frame (resulting in a negative fall distance). But that is then also overshot, so we're being moved from too far down, to too far up, and so forth.

As I understand the code now, the viewport matrix (walk->rv3d->viewinv) already operates in unit scale-adjusted space, so our delta (z_cur - z_new) is already the scaled value we need, so shouldn't be scaled again.
I've first disabled the dvec scale, which also solves the problem, but makes other parts (walking around with wasd) super slow, since those are scaled too.
So it seems the most correct to me to have the falling distance be done in non-scaled space, same as wasd and jump.

Here's a diff of a version I've been testing that seems to solve the problem, in source\blender\editors\space_view3d\view3d_navigate_walk.c, from line 1232:
image.png

I'm still testing this locally.

On a side note, I've been wondering whether it'd be nicer to pull this feature out of the core entirely, and move it to an addon. That way, it would be way easier to debug and make changes, or disable entirely. I'm assuming that by enabling such an addon by default and have it use the same keymap, it shouldn't be a breaking change.

Love to hear what you guys think!

I've found that this is due to the walk navigation incorrectly taking the unit scale into account, in the part where gravity, falling and jumping are handled. In fact, the unit scale is taken into account twice, resulting in the weird behavior. The falling part works as follows: - When we start to fall, the current viewport position (walk->rv3d->viewinv) is stored (walk->teleport.origin) - During every frame after this, the origin is taken, and a distance is subtracted based on the time since falling start and gravity, to simulate acceleration (z_new) - Because we need a delta and not an absolute value, the delta between the newly calculated z-value and the current z-value is taken (z_cur - z_new) - The delta is then set on the dvec vector - Later on, the dvec is scaled according to the unit scale - This overshoots the fall distance, which is compensated by the next frame (resulting in a negative fall distance). But that is then also overshot, so we're being moved from too far down, to too far up, and so forth. As I understand the code now, the viewport matrix (walk->rv3d->viewinv) already operates in unit scale-adjusted space, so our delta (z_cur - z_new) is already the scaled value we need, so shouldn't be scaled again. I've first disabled the dvec scale, which also solves the problem, but makes other parts (walking around with wasd) super slow, since those are scaled too. So it seems the most correct to me to have the falling distance be done in non-scaled space, same as wasd and jump. Here's a diff of a version I've been testing that seems to solve the problem, in source\blender\editors\space_view3d\view3d_navigate_walk.c, from line 1232: ![image.png](https://archive.blender.org/developer/F13697396/image.png) I'm still testing this locally. On a side note, I've been wondering whether it'd be nicer to pull this feature out of the core entirely, and move it to an addon. That way, it would be way easier to debug and make changes, or disable entirely. I'm assuming that by enabling such an addon by default and have it use the same keymap, it shouldn't be a breaking change. Love to hear what you guys think!
Member

Thx looking into this.
Mind sharing your fix as a Diff?
See https://wiki.blender.org/wiki/Process/Contributing_Code

Thx looking into this. Mind sharing your fix as a Diff? See https://wiki.blender.org/wiki/Process/Contributing_Code

This issue was referenced by a0bbd65d57

This issue was referenced by a0bbd65d57f38344fb71565c3c34396363a4be23

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Campbell Barton self-assigned this 2022-10-21 07:18:03 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#66713
No description provided.