Topic was automatically imported from the old Question2Answer platform.
Asked By
hsjaaa
get_slide_collision will return a KinematicCollision2D which contain a colliding body. How can I check if this colliding body is a instance of a scene and the scene’s parent scene?
Thanks!
for i in range(get_slide_count()):
var collision = get_slide_collision(i)
var collider = collision.collider
if collider is MyScene:
pass # code here
Thanks for your answer, I tried using is, but get error: Right operand of 'is' is not a class (type: 'PackedScene'). I instead declare a variable to define its type in the scene script, and I just need to use get to check if the colliding object has the variable.