How to temporarily ignore a collision, and how to refer to nodes outside a script's scene?
I'm creating a 2D platformer that includes ladders, and I need the vertical ladders to overlap my horizontal platform pieces. The player is a KinematicBody2D, the platform is a StaticBody2D, and the ladder is an Area2D. Using a signal in the Ladder script, When Player enters Ladder's area, the Player script allows up/down input and we can climb the ladder.
This is great until I'm going up a ladder and bonk my head on a platform piece that the ladder passes through on the way up.
When I'm not on a ladder, I absolutely do want those kinds of collisions, but when going up or down a ladder, I want to be able to walk freely up and down, past any platforms the ladder may intersect.
So I'm trying to find a way in gdscript to either:
- temporarily turn off the collision detection of an external node (CollisionShape2D has a "disabled" property that can be turned on... I can't figure out how to do that from a node in another scene)
- temporarily set my Player to ignore anything on the platforms layer (I don't know how to trigger this change in gdscript)
- in my Player script, temporarily add a collision exception for the platform, though I've been reading about it, and still can't figure out how to word it in gdscript.
So basically, an explanation of how to do any of the above would be greatly appreciated!
Also as you can see, I don't have a grasp on how to refer to nodes that are children of other scenes. So for example, from inside my Player scene's script (extending the main node of the Player scene, which is a KinematicBody2D), how do I refer to the CollisionShape2D of my Platform scene?
Thanks in advance for any light you may be able to shed on either of these questions!