32 lines
835 B
GDScript3
Raw Normal View History

2020-02-01 18:07:20 +01:00
extends PushingBodyPart
onready var anim = get_node("Mesh/AnimationPlayer")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
2020-02-02 12:14:27 +01:00
func _is_animation_playing():
return anim.is_playing()
2020-02-01 18:07:20 +01:00
func action():
anim.play("ArmatureAction")
func push(body):
# We multiply by 0.1 because we only want it to spin slightly, it should mostly go up
var offset = transform.basis.xform(touch_area.global_transform.origin - base.global_transform.origin) * 0.3
var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 10.0
2020-02-01 18:07:20 +01:00
base.apply_impulse(offset, direction)
#base.apply_torque_impulse(base.transform.basis.y * 20.0)
2020-02-01 18:07:20 +01:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
# pass