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

fix for applying scatter to objects with transformation

parent fe8cbeae
No related branches found
No related tags found
No related merge requests found
...@@ -112,10 +112,15 @@ def _main(self, ...@@ -112,10 +112,15 @@ def _main(self,
ray = obj.ray_cast ray = obj.ray_cast
closest_point_on_mesh = obj.closest_point_on_mesh closest_point_on_mesh = obj.closest_point_on_mesh
obj_mat = obj.matrix_world.copy()
obj_mat_inv = obj_mat.inverted()
# obj_quat = obj_mat.to_quaternion()
# obj_quat_inv = obj_mat_inv.to_quaternion()
DEBUG = False DEBUG = False
def fix_point(p): def fix_point(p):
hit, no, ind = closest_point_on_mesh(p) hit, no, ind = closest_point_on_mesh(obj_mat_inv * p)
if ind != -1: if ind != -1:
if DEBUG: if DEBUG:
return [p, no, None] return [p, no, None]
...@@ -294,8 +299,8 @@ def _main(self, ...@@ -294,8 +299,8 @@ def _main(self,
inst_ob.location = 0.0, 0.0, 0.0 inst_ob.location = 0.0, 0.0, 0.0
inst_ob.parent = obj_new inst_ob.parent = obj_new
# important to set last # align the object with worldspace
obj_new.matrix_world = obj.matrix_world obj_new.matrix_world = obj_mat
# BGE settings for testiing # BGE settings for testiing
''' '''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment