Overview
TheVectorDisplaySettings class extends Resource and provides comprehensive configuration options for customizing how vectors are rendered. It includes settings for visibility, rendering modes, colors, and color dimming effects.
Class Definition
Constants
Preloaded shortcut key for toggling vector visibility. Loaded from
res://addons/vector_display_2d/display_shortcut.tres.Internal constant for correcting dimming speed calculations.
Properties
Show Group
Show or hide all vector displays. This is the master visibility toggle.
Shows X and Y component vectors separately. When enabled, displays decomposed vector components in addition to the main vector.
Rendering Group
Change vectors size for visualization. This doesn’t change the actual vector values, only how they’re displayed.Range: 0.05 to 100+ (exponential, can exceed maximum)Use cases:
- Scale down large velocity values for better visibility
- Scale up small forces to make them visible
Line width in pixels for all vector lines.Range: 0.1 to 10+ (exponential, can exceed maximum)
Change the displayed vector length. Transformations don’t change the actual vector values.Options:
"Normal": Display vectors at their actual length (scaled byvector_scale)"Clamp": Limit vector length tomax_length"Normalize": Normalize vectors and scale tomax_length
Maximum length for vector clamping or normalizing. Only used when
length_mode is set to “Clamp” or “Normalize”.Range: 0.1 to 1000+ (exponential, can exceed maximum)Add an arrowhead at the end of vectors for better direction visualization.
Arrowhead size multiplier. Each unit is equivalent to 2 times the vector width.Range: 0.1 to 10+ (exponential, can exceed maximum)Example: With
width = 2 and arrowhead_size = 3.0, the arrowhead will be 12 pixels in size.Change the pivot point for the main vector.Options:
"Normal": Vector starts from origin (0, 0)"Centered": Vector scales symmetrically around its midpoint
Keep same pivot point for axes or override them.Options:
"Same": Use the same pivot mode as the main vector (recommended)"Normal": Force axes to start from origin"Centered": Force axes to be centered
Colors Group
Color for the main vector. Default is yellow (RGB: 1, 1, 0).
Color for the X component of the vector when
show_axes is enabled. Default is red.Color for the Y component of the vector when
show_axes is enabled. Default is green.Change main vector color based on its angle using HSV color space. Creates a rainbow effect where the color represents the vector’s direction.Note: Does not apply to axes colors.
Color Dimming Group
Enables color dimming effect. When enabled, vector colors fade toward the
fallback_color as the vector length decreases.Controls how quickly colors dim as vectors get shorter. Higher values cause faster dimming.Range: 0.01 to 10+ (can exceed maximum)
The color that vectors fade toward when they get short. Default is black.
Apply dimming based on different vector length calculations. Useful when using “Normalize” length mode.Options:
"None": No special dimming calculation"Absolute": Dim based on the actual vector value (with scale applied)"Visual": Dim based on the displayed visual length (after length mode transformation)
Usage Examples
Basic Settings
Normalized Vectors with Rainbow Colors
Physics Debugging with Dimming
Centered Pivot Display
Custom Color Scheme
Saving Settings as Resource
Notes
- All settings emit the
changedsignal when modified, triggering automatic redraws - Settings can be created via code or saved as
.tresresource files for reuse - The
@export_rangeannotations provide UI sliders in the Godot editor - Color dimming works best with
dimming_speedvalues between 0.5 and 5.0 - Rainbow mode overrides
main_colorbut not axis colors
