@@ -306,23 +306,23 @@ def is_valid_position(self, levelscript : LevelScriptParser, obj : Object3D,posi
306
306
self .log_reason_for_reject ("is_valid_position" , "object position above max_y" )
307
307
return False
308
308
309
- if "distance " in rules :
310
- for distance_rules in rules ["distance " ]:
311
- origin = distance_rules ["origin" ]
309
+ if "distance_to " in rules :
310
+ for distance_rule in rules ["distance_to " ]:
311
+ origin = distance_rule ["origin" ]
312
312
313
313
distance = math .sqrt (
314
314
(position [0 ] - origin [0 ]) ** 2 +
315
315
(position [1 ] - origin [1 ]) ** 2 +
316
316
(position [2 ] - origin [2 ]) ** 2
317
317
)
318
318
319
- if "max_distance" in distance_rules :
320
- if distance > distance_rules ["max_distance" ]:
319
+ if "max_distance" in distance_rule :
320
+ if distance > distance_rule ["max_distance" ]:
321
321
self .log_reason_for_reject ("is_valid_position" , "object too far away from origin" )
322
322
return False
323
323
324
- if "min_distance" in distance_rules :
325
- if distance > distance_rules ["min_distance" ]:
324
+ if "min_distance" in distance_rule :
325
+ if distance > distance_rule ["min_distance" ]:
326
326
self .log_reason_for_reject ("is_valid_position" , "object too close to origin" )
327
327
return False
328
328
@@ -524,6 +524,8 @@ def generate_random_point_for(self, levelscript : LevelScriptParser, obj : Objec
524
524
(bounds_min , bounds_max ) = area_mesh .bounds
525
525
(x , y , z ) = bounds_min
526
526
527
+ # TODO: Check the rules here to more accurately set a bounding box in which to randomize, shits unoptimized yo
528
+
527
529
# position for boundary is slightly overshot, probably because of some shit i forgot to write here while it happened
528
530
if abs (bounds_min [0 ] - bounds_max [0 ]) > 0 :
529
531
x = random .randrange (bounds_min [0 ] + 1000 , bounds_max [0 ] - 1000 )
0 commit comments