Page MenuHome

Python bvh tree - find_nearest (or raycast), gives bad result on object with Shrink Wrap modifier.
Closed, ArchivedPublic

Description

System Information
Operating system: Linux-5.6.19-2-MANJARO-x86_64-with-arch-Manjaro-Linux 64 Bits
Graphics card: GeForce GTX 1660 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.100

Blender Version
Broken: version: 2.83.2, branch: master, commit date: 2020-07-09 05:50, hash: rB239fbf7d936f
Worked: Not sure if ever worked

Short description of error
When using bvht.find_nearest() (or raycast) on object with shrink wrap modifier, we get bad location result. Works ok with other modifiers.

Exact steps for others to reproduce the error

Open blend file and run script
If ShrinkedSphere has ShrinkWrap modifier disabled, we get correct find_nearest result - Vector (0.0000, 0.0639, 1.8995) (object is seen in world space, with other modifiers applied)
If we enable shrink wrap modifier, the then we get bad result <Vector (-0.0047, 0.0007, 0.0611)>

Blend file:

Event Timeline

Thanks for the report, but I don't believe this is a bug.

When you change the position of the mesh vertices in the line:

obj.data.transform(obj.matrix_world)

you change the result of the Shrinkwrap modifier, so BVH is not what you expect.

For help using Blender, please try one of the community websites: https://www.blender.org/community/

If you think you found a bug, please submit a new report and carefully follow the instructions.

Note that the sample file could still be simplified further.