Skip to content

Commit

Permalink
Fix Mangle Check in Light for SpotLight Generation
Browse files Browse the repository at this point in the history
Used to use a check for 0.005 exactly, but float imprecision would still trigger the SpotLight spawn instead of the OmniLight spawn. Modified the range to be slightly wider to allow room for imprecision.
  • Loading branch information
RhapsodyInGeek authored Mar 12, 2024
1 parent c5a7afb commit 3c611e7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions addons/qodot/game_definitions/fgd/point_classes/light.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ func update_properties():
for child in get_children():
remove_child(child)
child.queue_free()
light_node = null

if 'mangle' in properties and (properties['mangle'] as Vector3).x != 0.005:
light_node = SpotLight3D.new()
if 'mangle' in properties:
var mangle: Vector3 = properties['mangle'] as Vector3
if mangle.x < 0.0049 or mangle.x > 0.0051:
light_node = SpotLight3D.new()
light_node.rotate(Vector3.UP, deg_to_rad(180 + mangle.x))
light_node.rotate(light_node.transform.basis.x, deg_to_rad(180 + mangle.y))
if 'angle' in properties:
light_node.set_param(Light3D.PARAM_SPOT_ANGLE, (properties['angle'] as float))

var yaw = properties['mangle'].x
var pitch = properties['mangle'].y
light_node.rotate(Vector3.UP, deg_to_rad(180 + yaw))
light_node.rotate(light_node.transform.basis.x, deg_to_rad(180 + pitch))

if 'angle' in properties:
light_node.set_param(Light3D.PARAM_SPOT_ANGLE, properties['angle'])
else:
if light_node == null:
light_node = OmniLight3D.new()

var light_brightness = 300
Expand Down

0 comments on commit 3c611e7

Please sign in to comment.