Skip to content
This repository was archived by the owner on Dec 14, 2025. It is now read-only.

Commit 3c611e7

Browse files
Fix Mangle Check in Light for SpotLight Generation
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.
1 parent c5a7afb commit 3c611e7

File tree

1 file changed

+10
-10
lines changed
  • addons/qodot/game_definitions/fgd/point_classes

1 file changed

+10
-10
lines changed

addons/qodot/game_definitions/fgd/point_classes/light.gd

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ func update_properties():
1111
for child in get_children():
1212
remove_child(child)
1313
child.queue_free()
14+
light_node = null
1415

15-
if 'mangle' in properties and (properties['mangle'] as Vector3).x != 0.005:
16-
light_node = SpotLight3D.new()
16+
if 'mangle' in properties:
17+
var mangle: Vector3 = properties['mangle'] as Vector3
18+
if mangle.x < 0.0049 or mangle.x > 0.0051:
19+
light_node = SpotLight3D.new()
20+
light_node.rotate(Vector3.UP, deg_to_rad(180 + mangle.x))
21+
light_node.rotate(light_node.transform.basis.x, deg_to_rad(180 + mangle.y))
22+
if 'angle' in properties:
23+
light_node.set_param(Light3D.PARAM_SPOT_ANGLE, (properties['angle'] as float))
1724

18-
var yaw = properties['mangle'].x
19-
var pitch = properties['mangle'].y
20-
light_node.rotate(Vector3.UP, deg_to_rad(180 + yaw))
21-
light_node.rotate(light_node.transform.basis.x, deg_to_rad(180 + pitch))
22-
23-
if 'angle' in properties:
24-
light_node.set_param(Light3D.PARAM_SPOT_ANGLE, properties['angle'])
25-
else:
25+
if light_node == null:
2626
light_node = OmniLight3D.new()
2727

2828
var light_brightness = 300

0 commit comments

Comments
 (0)