Skip to content

Instantly share code, notes, and snippets.

@laurentsenta
Created March 6, 2025 13:47
Show Gist options
  • Save laurentsenta/f31f1570c55713a9776cfbcdc7b4bb92 to your computer and use it in GitHub Desktop.
Save laurentsenta/f31f1570c55713a9776cfbcdc7b4bb92 to your computer and use it in GitHub Desktop.
terrain 3d blend value checker
@tool
extends RayCast3D
@export var terrain: Terrain3D
@export var debug: bool = false
@export var base_texture_id: int
@export var overlay_id: int
@export var blend_value: float
func _ready() -> void:
if Engine.is_editor_hint():
pass
else:
queue_free()
func _process(delta: float) -> void:
if !terrain or !debug:
return
var t := terrain.data.get_texture_id(global_position)
base_texture_id = int(t.x) if not is_nan(t.x) else NAN
overlay_id = int(t.y) if not is_nan(t.y) else NAN
blend_value = t.z
#print_debug(t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment