Skip to content

Adds sin, cos and tan trigonometry function #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions addons/block_code/blocks/math/cos.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://c6g6ljp46lfrj"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_lxbvo"]

[resource]
script = ExtResource("1_lxbvo")
name = &"cos"
description = "Calculate the cosine of [i]angle[/i]"
category = "Math"
type = 3
variant_type = 3
display_template = "cos {angle: FLOAT}"
code_template = "cos(deg_to_rad({angle}))"
defaults = {
"angle": 0.0
}
signal_name = ""
scope = ""
18 changes: 18 additions & 0 deletions addons/block_code/blocks/math/sin.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://b1r7f06rfci6o"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_dlr47"]

[resource]
script = ExtResource("1_dlr47")
name = &"sin"
description = "Calculate the sine of [i]angle[/i]"
category = "Math"
type = 3
variant_type = 3
display_template = "sin {angle: FLOAT}"
code_template = "sin(deg_to_rad({angle}))"
defaults = {
"angle": 0.0
}
signal_name = ""
scope = ""
18 changes: 18 additions & 0 deletions addons/block_code/blocks/math/tan.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://blpo01pjjheqb"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_e2566"]

[resource]
script = ExtResource("1_e2566")
name = &"tan"
description = "Calculate the tangent of [i]angle[/i]"
category = "Math"
type = 3
variant_type = 3
display_template = "tan {angle: FLOAT}"
code_template = "tan(deg_to_rad({angle}))"
defaults = {
"angle": 0.0
}
signal_name = ""
scope = ""
2 changes: 1 addition & 1 deletion addons/block_code/ui/picker/categories/category_factory.gd
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static func get_general_blocks() -> Array[Block]:
block_list.append(b)

# Math
for block_name in [&"add", &"subtract", &"multiply", &"divide", &"pow", &"randf_range", &"randi_range"]:
for block_name in [&"add", &"subtract", &"multiply", &"divide", &"pow", &"randf_range", &"randi_range", &"sin", &"cos", &"tan"]:
b = Util.instantiate_block(block_name)
block_list.append(b)

Expand Down