Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Bugsbane | |
Old Version | Published before Godot 3 was released. |
I’m trying to detect if any object is colliding with a specific area2d I’m using as a hit box. Currently I’m just using is_colliding, however I keep getting an error:
Invalid call. Nonexistent function ‘is_colliding’
Yet I see is_colliding used in example tutorials all over the web, and the only difference I can see is that they’re attaching it to a kinematic character2d. Can this be used with area2d? Is there a better way? Here’s my code:
extends Area2D
func _ready():
set_fixed_process(true)
func _fixed_process(delta):
if(get_node(".").is_colliding()):
print("Collision!")
no need to use get_node(".")
, since you’re already in the object you can use self.is_colliding()
, or even simply is_colliding()
.
Dr_TwiSteD | 2017-07-21 12:44