├── .gitattributes ├── .gitignore ├── addons └── easy_velocity_vector_display │ ├── VectorDisplayIcon.png │ ├── plugin.gd │ ├── plugin.cfg │ ├── icon.svg │ └── vectordisplay2D.gd ├── README.md └── LICENSE /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Godot-specific ignores 3 | .import/ 4 | export.cfg 5 | export_presets.cfg 6 | 7 | # Mono-specific ignores 8 | .mono/ 9 | -------------------------------------------------------------------------------- /addons/easy_velocity_vector_display/VectorDisplayIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neropatti/easy_vector_display/HEAD/addons/easy_velocity_vector_display/VectorDisplayIcon.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Easy Vector Display 2 | This add-on adds the node `VectorDisplay2D`. Just point it to a node, and enter in the property you want displayed. 3 | 4 | Currently only supports `Vector2`. 5 | 6 | Hit `V` to toggle the vector display. 7 | -------------------------------------------------------------------------------- /addons/easy_velocity_vector_display/plugin.gd: -------------------------------------------------------------------------------- 1 | @tool 2 | extends EditorPlugin 3 | 4 | func _enter_tree(): 5 | add_custom_type("VectorDisplay2D", "Node2D", preload("vectordisplay2D.gd"), preload("icon.svg")) 6 | 7 | 8 | func _exit_tree(): 9 | remove_custom_type("VectorDisplay2D") 10 | -------------------------------------------------------------------------------- /addons/easy_velocity_vector_display/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="Easy velocity vector display" 4 | description="Display your character's velocity. Easily. 5 | Add a custom node called \"VectorDisplay2D\" 6 | Press \"V\" to toggle the display." 7 | author="neropatti" 8 | version="2.0" 9 | script="plugin.gd" 10 | -------------------------------------------------------------------------------- /addons/easy_velocity_vector_display/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /addons/easy_velocity_vector_display/vectordisplay2D.gd: -------------------------------------------------------------------------------- 1 | extends Node2D 2 | 3 | @export var target : NodePath 4 | @export var target_property : String 5 | @export var vector_scale : float = 1 6 | 7 | var target_node = null 8 | 9 | var b : Vector2 = Vector2.ZERO 10 | 11 | func _draw(): 12 | draw_line(Vector2(0,0), Vector2(b.x,0) * vector_scale, Color(0,0,1), 2, true) 13 | draw_line(Vector2(0,0), Vector2(0,b.y) * vector_scale, Color(1,0,0), 2, true) 14 | draw_line(Vector2(0,0), b * vector_scale, Color(0.9,0,0.9), 2, true) 15 | 16 | func _ready(): 17 | target_node = get_node(target) 18 | 19 | func _physics_process(delta): 20 | b = target_node.get(target_property) 21 | queue_redraw() 22 | 23 | func _unhandled_key_input(event): 24 | if event.keycode == KEY_V and event.pressed: 25 | self.visible = !self.visible 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 neropatti 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------