Walk Navigation fails to use gravity with intersecting objects #47838

Closed
opened 2016-03-18 13:52:26 +01:00 by Alex · 11 comments

System Information
Intel Core i7, 8 Gb RAM, AMD Radeon HD 7700
Windows 7 x64

Blender Version
Broken: 2.77 cc12fc1
Worked: 2.76b f337fea

Short description of error
Walk Navigation fails to use gravity with intersecting objects

Exact steps for others to reproduce the error
This bug took me more than two weeks to separate the exact reproducible case so please take a look at the attached Blend file: open the file, activate View -> Navigation -> Walk Navigation and teleport to the selected (new) plane. Activate gravity by pressing "G" and walk towards the next (old) plane:

  1. In 2.76 you will eventually step on the old plane and go up just as expected.
  2. In 2.77 you will walk through it instead of going up. Sometimes this doesn’t happen right away so you’ll just have to walk across the intersection a couple of times.
    Just in case I’ve tried to add Solidify modifier and it didn’t help and later I was able to reproduce the same case with squashed cubes so it happens on solid objects as well.

If you want to reproduce the case itself, here are the steps to do it:

  1. Open Blender, remove the default Cube and add a single Plane.
  2. Scale that plane by regular scaling so it will be big enough to walk on (something like 20x20 should be enough) and apply the scale. (I'm not sure, but it looks like that scale is not the issue here.)
  3. Enter Edit Mode, select the right edge and raise it to create a slope. Exit Edit Mode.
  4. Create another plane by adding another primitive or by duplicating the first one. (It looks like that the key point here is to have a new object.)
  5. Enter Edit Mode on the second plane and raise the left edge so both planes will become intersected somewhere. Exit Edit Mode. (The key point here is that planes are intersecting.)
  6. Use View -> Navigation -> Walk Navigation and move or teleport to the first (old) plane. Activate gravity by pressing "G" and try to walk from one plane to another a couple of times.

The whole thing proved to be a problem for level design because you won’t be able to walk through your level if some of its parts are intersecting. This is not a major bug, but it doesn’t happen in 2.76 and it may indicate a problem somewhere else so I really hope that it will be fixed.
WalkModeBug.blend

**System Information** Intel Core i7, 8 Gb RAM, AMD Radeon HD 7700 Windows 7 x64 **Blender Version** Broken: 2.77 cc12fc1 Worked: 2.76b f337fea **Short description of error** Walk Navigation fails to use gravity with intersecting objects **Exact steps for others to reproduce the error** This bug took me more than two weeks to separate the exact reproducible case so please take a look at the attached Blend file: open the file, activate View -> Navigation -> Walk Navigation and teleport to the selected (new) plane. Activate gravity by pressing "G" and walk towards the next (old) plane: 1. In 2.76 you will eventually step on the old plane and go up just as expected. 2. In 2.77 you will walk through it instead of going up. Sometimes this doesn’t happen right away so you’ll just have to walk across the intersection a couple of times. Just in case I’ve tried to add Solidify modifier and it didn’t help and later I was able to reproduce the same case with squashed cubes so it happens on solid objects as well. If you want to reproduce the case itself, here are the steps to do it: 1. Open Blender, remove the default Cube and add a single Plane. 2. Scale that plane by regular scaling so it will be big enough to walk on (something like 20x20 should be enough) and apply the scale. (I'm not sure, but it looks like that scale is not the issue here.) 3. Enter Edit Mode, select the right edge and raise it to create a slope. Exit Edit Mode. 4. Create another plane by adding another primitive or by duplicating the first one. (It looks like that the key point here is to have a new object.) 5. Enter Edit Mode on the second plane and raise the left edge so both planes will become intersected somewhere. Exit Edit Mode. (The key point here is that planes are intersecting.) 6. Use View -> Navigation -> Walk Navigation and move or teleport to the first (old) plane. Activate gravity by pressing "G" and try to walk from one plane to another a couple of times. The whole thing proved to be a problem for level design because you won’t be able to walk through your level if some of its parts are intersecting. This is not a major bug, but it doesn’t happen in 2.76 and it may indicate a problem somewhere else so I really hope that it will be fixed. [WalkModeBug.blend](https://archive.blender.org/developer/F296741/WalkModeBug.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @SpectreFirst

Added subscriber: @SpectreFirst

Added subscriber: @NikoLeopold

Added subscriber: @NikoLeopold

Added subscriber: @Sergey

Added subscriber: @Sergey
Bastien Montagne was assigned by Sergey Sharybin 2016-03-22 16:57:50 +01:00

Caused by 3ad0344.

Caused by 3ad0344.
Bastien Montagne was unassigned by Germano Cavalcante 2016-03-22 19:39:27 +01:00
Germano Cavalcante self-assigned this 2016-03-22 19:39:27 +01:00

Added subscriber: @mont29

Added subscriber: @mont29

Here is a possible solution.

diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 3622012..26c2427 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1574,7 +1574,7 @@ static bool snapDerivedMesh(
                                        bb = &bb_temp;
                                }
 
-                               len_diff = local_depth;
+                               len_diff = BVH_RAYCAST_DIST_MAX;
                                if (!BKE_boundbox_ray_hit_check(bb, ray_start_local, ray_normal_local, &len_diff)) {
                                        return retval;
                                }
 

When the ray is inside the bound the box, the lamda of "BKE_boundbox_ray_hit_check" can be greater than the depth of the object. :/

Here is a possible solution. ``` diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 3622012..26c2427 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1574,7 +1574,7 @@ static bool snapDerivedMesh( bb = &bb_temp; } - len_diff = local_depth; + len_diff = BVH_RAYCAST_DIST_MAX; if (!BKE_boundbox_ray_hit_check(bb, ray_start_local, ray_normal_local, &len_diff)) { return retval; } ``` When the ray is inside the bound the box, the lamda of "BKE_boundbox_ray_hit_check" can be greater than the depth of the object. :/
Germano Cavalcante removed their assignment 2016-03-22 20:56:13 +01:00
Bastien Montagne was assigned by Germano Cavalcante 2016-03-22 20:56:13 +01:00

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Another solution is to use "isect_ray_aabb_v3", it is much more efficient, allows depth negative and still ignores BoundBox that are fully behind the ray.

However it is not very accurate.

diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 3622012..1a3033a 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1574,8 +1574,12 @@ static bool snapDerivedMesh(
 					bb = &bb_temp;
 				}
 
-				len_diff = local_depth;
-				if (!BKE_boundbox_ray_hit_check(bb, ray_start_local, ray_normal_local, &len_diff)) {
+				//len_diff = local_depth
+				/* BKE_boundbox_ray_hit_check does not accept negative values for the lambda */
+				struct IsectRayAABB_Precalc data;
+				isect_ray_aabb_v3_precalc(&data, ray_start_local, ray_normal_local);
+				if (!isect_ray_aabb_v3(&data, bb->vec[0], bb->vec[6], &len_diff) ||
+				   (len_diff > local_depth)) {
 					return retval;
 				}
 				need_ray_start_correction_init = false;


Another solution is to use "isect_ray_aabb_v3", it is much more efficient, allows depth negative and still ignores BoundBox that are fully behind the ray. However it is not very accurate. ``` diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 3622012..1a3033a 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1574,8 +1574,12 @@ static bool snapDerivedMesh( bb = &bb_temp; } - len_diff = local_depth; - if (!BKE_boundbox_ray_hit_check(bb, ray_start_local, ray_normal_local, &len_diff)) { + //len_diff = local_depth + /* BKE_boundbox_ray_hit_check does not accept negative values for the lambda */ + struct IsectRayAABB_Precalc data; + isect_ray_aabb_v3_precalc(&data, ray_start_local, ray_normal_local); + if (!isect_ray_aabb_v3(&data, bb->vec[0], bb->vec[6], &len_diff) || + (len_diff > local_depth)) { return retval; } need_ray_start_correction_init = false; ```

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

This issue was referenced by 75849b099f

This issue was referenced by 75849b099f28cfcecd578122e2bfd227468eacf5
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
6 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#47838
No description provided.