Skip to content
Snippets Groups Projects
Commit 5e69d4b4 authored by Campbell Barton's avatar Campbell Barton
Browse files

Update for changes to ray_cast/closest_point_on_mesh

parent 22830652
Branches
Tags
No related merge requests found
...@@ -91,8 +91,8 @@ def _main(self, ...@@ -91,8 +91,8 @@ def _main(self,
DEBUG = False DEBUG = False
def fix_point(p): def fix_point(p):
hit, no, ind = closest_point_on_mesh(obj_mat_inv * p) ok, hit, no, ind = closest_point_on_mesh(obj_mat_inv * p)
if ind != -1: if ok:
if DEBUG: if DEBUG:
return [p, no, None] return [p, no, None]
else: else:
...@@ -151,13 +151,12 @@ def _main(self, ...@@ -151,13 +151,12 @@ def _main(self,
m_alt_2 = Matrix.Rotation(radians(-22.5), 3, n) m_alt_2 = Matrix.Rotation(radians(-22.5), 3, n)
for _m in mats: for _m in mats:
for m in (_m, m_alt_1 * _m, m_alt_2 * _m): for m in (_m, m_alt_1 * _m, m_alt_2 * _m):
hit, nor, ind = ray(pofs, pofs + (m * n_seek)) pdir = m * n_seek
if ind != -1: ok, hit, nor, ind = ray(pofs, pdir, best_dist)
dist = (pofs - hit).length if ok:
if dist < best_dist: best_dist = (pofs - hit).length
best_dist = dist best_nor = nor
best_nor = nor # best_hit = hit
#best_hit = hit
if best_nor: if best_nor:
pt[1].length = best_dist pt[1].length = best_dist
...@@ -211,9 +210,9 @@ def _main(self, ...@@ -211,9 +210,9 @@ def _main(self,
ntmp.y += uniform(-l, l) * RAND_LOC ntmp.y += uniform(-l, l) * RAND_LOC
ntmp.z += uniform(-l, l) * RAND_LOC ntmp.z += uniform(-l, l) * RAND_LOC
hit, hit_no, ind = ray(vantage, vantage + ntmp) ok, hit, hit_no, ind = ray(vantage, ntmp, ntmp.length)
# print(hit, hit_no) # print(hit, hit_no)
if ind != -1: if ok:
if hit_no.angle(Z_UP) < WALL_LIMIT: if hit_no.angle(Z_UP) < WALL_LIMIT:
hits.append(hit) hits.append(hit)
nors.append(hit_no) nors.append(hit_no)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment