35 lines
755 B
GDScript

extends Spatial
class_name BodyPart
# Must be the direct child of an AttachmentPoint of the BodyBase
onready var base = get_parent().get_parent().get_parent()
onready var physics_shape = get_node("PartCollider")
var setup_done = false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
assert(base is BodyBase)
func _process(delta: float) -> void:
# We do this here because we want the whole tree to really be done instancing
if not setup_done:
var translation = physics_shape.global_transform
print(translation)
remove_child(physics_shape)
base.add_child(physics_shape)
physics_shape.global_transform = translation
setup_done = true
# Do something with the base
func action():
pass