Bullhead playing animation
This commit is contained in:
parent
01b33b3ae4
commit
5a3e52270e
@ -1,16 +1,31 @@
|
||||
extends PushingBodyPart
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
onready var anim = get_node("Mesh/AnimationPlayer")
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
func _is_animation_playing():
|
||||
return anim.is_playing()
|
||||
|
||||
|
||||
func action():
|
||||
anim.play("ArmatureAction")
|
||||
|
||||
# Apply a slight counter force
|
||||
var offset = transform.basis.xform(Vector3.ZERO) #transform.basis.xform(touch_area.global_transform.origin - base.global_transform.origin) * 0.5
|
||||
var direction = -(base.transform.basis.y - base.transform.basis.z).normalized() * 0.5
|
||||
|
||||
base.apply_impulse(offset, direction)
|
||||
|
||||
|
||||
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(Vector3.ZERO) #transform.basis.xform(touch_area.global_transform.origin - base.global_transform.origin) * 0.5
|
||||
var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 19.0
|
||||
|
||||
base.apply_impulse(offset, direction)
|
||||
|
Loading…
x
Reference in New Issue
Block a user