+1 vote

I'm trying to make my character to drop through a platform (like Castlevania SotN). The way that I was trying to do it was disabling the collision of the platform. But of course that if do it, it will disable the collision of this platform with all other objects(including enemies in this platform).

Is it possible to only disable the collision of an CollisionShape2D with an specific object, instead of disabling all collisions?

Thanks in advance ^^'

in Engine by (23 points)

1 Answer

+2 votes
Best answer

Collision layers are designed for exactly this. See this link for an overview:

by (21,531 points)
selected by

Thank you! ^^
It is a really good solution. But I solved my problem by using addexceptionwith(obj), that KinematicBody2D inherits from PhysicsBody2D!

Thank you for your comment, @rless - it was just what I was looking for. I am using layers and masks, but sometimes you just need something more granular. For example: a car shouldn't collide with its driver but should collide with everyone else, even his allies.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.