Browse Source

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.
pull/394/head
Adam Johnson 11 months ago
parent
commit
9339b29d48
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 8
      korman/nodes/node_conditions.py

8
korman/nodes/node_conditions.py

@ -332,12 +332,12 @@ class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket):
node = self.node node = self.node
directional = False directional = False
moving_forward = False moving_forward = False
tolerance = math.radians(45.0) tolerance = math.cos(math.radians(45.0))
elif self.is_linked: elif self.is_linked:
node = self.links[0].from_node node = self.links[0].from_node
directional = node.directional directional = node.directional
moving_forward = node.moving_forward moving_forward = node.moving_forward
tolerance = node.tolerance tolerance = math.cos(node.tolerance)
else: else:
# This is a programmer failure, so we need a traceback. # This is a programmer failure, so we need a traceback.
raise RuntimeError("Tried to export an unused PlasmaFacingTargetSocket") raise RuntimeError("Tried to export an unused PlasmaFacingTargetSocket")
@ -347,10 +347,10 @@ class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket):
facing = facing_key.object facing = facing_key.object
facing.directional = directional facing.directional = directional
facing.satisfied = True facing.satisfied = True
facing.tolerance = math.radians(tolerance) facing.tolerance = tolerance
logicmod.addCondition(facing_key) logicmod.addCondition(facing_key)
elif isinstance(logicmod, plObjectInVolumeAndFacingDetector): elif isinstance(logicmod, plObjectInVolumeAndFacingDetector):
logicmod.facingTolerance = math.cos(math.radians(tolerance)) logicmod.facingTolerance = tolerance
logicmod.needWalkingForward = moving_forward logicmod.needWalkingForward = moving_forward
else: else:
raise ValueError("logicmod") raise ValueError("logicmod")

Loading…
Cancel
Save