2020-02-02 13:18:18 +01:00

40 lines
884 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
export(float) var cost
# 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)
var attach_id = get_parent().get_parent().id
remove_child(physics_shape)
physics_shape.name = "LimbCollider" + str(attach_id)
base.add_child(physics_shape)
physics_shape.global_transform = translation
setup_done = true
# Do something with the base
func action():
pass