This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Node | |
| export (float, 0.0, 10.0) var margin_offset: = 5.0 | |
| export (float, 4.0, 100.0) var boom_length: = 16 | |
| export (float) var move_weight: = 5.0 | |
| var _follow_target_bounds: = AABB() | |
| var _velocity: = Vector3.ZERO | |
| var _tan_vertical_fov: = 0.0 | |
| var _tan_horizontal_fov: = 0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends StateMachine | |
| const MAX_MOVE_SLIDES: = 6 | |
| const Ragdoll: = preload("states/ragdoll.gd") | |
| const Falling: = preload("states/falling.gd") | |
| const Grounded: = preload("states/grounded.gd") | |
| const Crouched: = preload("states/crouched.gd") | |
| const STATE_RAGDOLL: = "Ragdoll" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class_name StateMachine | |
| extends Node | |
| """ | |
| An automata implemented as a Node which supports a pushdown stack. | |
| The below is a state machine that can be used as a finite state machine or a | |
| pushdown automata by using Object or Object-derived instances as nodes. | |
| Implement one of the following callback functions in the state object to get the | |
| relevant behaviour. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shader_type spatial; | |
| render_mode cull_front, unshaded; | |
| // Set this value as 2 * outline_width_in_pixels * (1 / screen_size.xy) | |
| //uniform vec2 scaled_outline_width = vec2(0.0039, 0.0069); | |
| uniform float outline_width = 2.0; | |
| uniform vec4 outline_color: hint_color; | |
| void vertex () { | |
| // Move to clip space before applying the vertex growth. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class_name NodeUtils | |
| static func get_children_of_type(node: Node, type) -> Array: | |
| var ret: = [] | |
| for child in node.get_children(): | |
| if child is type: | |
| ret.append(child) | |
| if child.get_child_count() > 0: | |
| ret += get_children_of_type(child, type) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class_name MathUtils | |
| static func clamp_magnitude(vector, amount): | |
| return vector if vector.length() < abs(amount) else vector.normalized() * amount | |
| static func get_aabb_center(bounds: AABB) -> Vector3: | |
| return bounds.position + bounds.size / 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Node | |
| ## Based on https://github.com/Zylann/godot_debug_draw | |
| ## @brief Single-file autoload for debug drawing and printing. | |
| ## Draw and print on screen from anywhere in a single line of code. | |
| # TODO: Thread-safety | |
| # TODO: 2D functions | |
| ## @brief How many frames HUD text lines remain shown after being invoked. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import sys | |
| def ensure_site_packages(packages): | |
| """ `packages`: list of tuples (<import name>, <pip name>) """ | |
| if not packages: | |
| return | |
| import site |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shader_type spatial; | |
| render_mode unshaded; | |
| uniform sampler2D pattern_map: hint_albedo; | |
| uniform vec2 uv_offset = vec2(0.5, 0.5); | |
| uniform vec2 uv_tiling = vec2(1.0, 1.0); | |
| float when_lt(float x, float y) { | |
| return max(sign(y - x), 0.0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Generates a unique string for use as ID(s). | |
| * @summary Similar in concept to | |
| * <http://wiki.ecmascript.org/doku.php?id=strawman:names>. | |
| * | |
| * The goals of this function are twofold: | |
| * | |
| * - Provide a way to generate a string guaranteed to be unique when compared | |
| * to other strings generated by this function. |