grunk/src/equipment/sticker_pack/world_sticker.gd
Rob Kelly 980efdb5e6
Some checks failed
linting & formatting / build (push) Failing after 20s
Custom stickers can be loaded from user://stickers
2025-06-28 18:33:17 -06:00

23 lines
588 B
GDScript

class_name WorldSticker extends Sprayable
@onready var decal: Decal = %Decal
func _hit() -> void:
# Remove on hit
queue_free()
## Place this sticker at a given point, aligned to the given normal, with the given texture.
func place(texture: Texture2D, point: Vector3, normal: Vector3, src_up: Vector3) -> void:
decal.texture_albedo = texture
global_position = point
# Build basis
var up := -normal
var right := up.cross(src_up).normalized()
var forward := -right.cross(up).normalized()
global_basis = Basis(right, up, forward)
# TODO handle serialization & deserialization