giants-godot/assets/Water.gd
2021-09-08 18:36:41 +02:00

27 lines
620 B
GDScript3

extends MeshInstance
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_Area_body_entered(body):
var body_velocity = Vector3.ZERO
if body is KinematicBody:
body_velocity = body.velocity
elif body is RigidBody:
body_velocity = body.linear_velocity
var height_speed = -body_velocity.y
print(str(body)+" has entered water at speed "+ str(body_velocity))