From 9339b29d4883eeccccee554bba8fc27e3854b89a Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 6 Jan 2024 18:59:32 -0500 Subject: [PATCH] Fix #388. Both the facing target conditional and object in volume and facing detector store the cosine of the angle. We were only doing the cosine for one case but not the other. --- korman/nodes/node_conditions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/korman/nodes/node_conditions.py b/korman/nodes/node_conditions.py index 3071e88..32dcb1c 100644 --- a/korman/nodes/node_conditions.py +++ b/korman/nodes/node_conditions.py @@ -332,12 +332,12 @@ class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket): node = self.node directional = False moving_forward = False - tolerance = math.radians(45.0) + tolerance = math.cos(math.radians(45.0)) elif self.is_linked: node = self.links[0].from_node directional = node.directional moving_forward = node.moving_forward - tolerance = node.tolerance + tolerance = math.cos(node.tolerance) else: # This is a programmer failure, so we need a traceback. raise RuntimeError("Tried to export an unused PlasmaFacingTargetSocket") @@ -347,10 +347,10 @@ class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket): facing = facing_key.object facing.directional = directional facing.satisfied = True - facing.tolerance = math.radians(tolerance) + facing.tolerance = tolerance logicmod.addCondition(facing_key) elif isinstance(logicmod, plObjectInVolumeAndFacingDetector): - logicmod.facingTolerance = math.cos(math.radians(tolerance)) + logicmod.facingTolerance = tolerance logicmod.needWalkingForward = moving_forward else: raise ValueError("logicmod")