16 lines
412 B
GDScript3
16 lines
412 B
GDScript3
|
|
class_name CrouchVolume extends Area3D
|
||
|
|
|
||
|
|
func ready():
|
||
|
|
body_entered.connect(notify_player_entry)
|
||
|
|
body_exited.connect(notify_player_exit)
|
||
|
|
|
||
|
|
func notify_player_entry(body: RigidBody3D):
|
||
|
|
print("Player entered Crouch area.")
|
||
|
|
if body is Player:
|
||
|
|
body.inside_crouch_volume.append(self)
|
||
|
|
|
||
|
|
func notify_player_exit(body: RigidBody3D):
|
||
|
|
if body is Player:
|
||
|
|
body.inside_crouch_volume.erase(self)
|
||
|
|
body.crouched = false
|