grunk/src/equipment/sticker_pack/world_sticker.gd

23 lines
588 B
GDScript3
Raw Normal View History

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