Replies: 1 comment
-
Does |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need my character (CharacterBody2D) to be able to hit an enemy collider by jumping at it (vertically like Mario, or in any direction like Sonic), and allow the character to temporarily stop colliding with the enemy collider(s) after that.
The exceptions could be set with a separate method
add_exception
, or as an optional parameter tomove_and_slide
.It can serve different purpose:
Currently, RayCast2D (https://docs.godotengine.org/en/stable/classes/class_raycast2d.html) already has an API to exclude certain colliders, the add_exception method (and opposite to remove one/clear all of them) as well as the more low-level PhysicsRayQueryParameters2D.exclude array (https://docs.godotengine.org/en/stable/classes/class_physicsrayqueryparameters2d.html).
Even ShapeCast2D (https://docs.godotengine.org/en/stable/classes/class_shapecast2d.html) has add_exception, and that's the closest to what CharacterBody2D move_and_slide does (without the more complex sliding part).
For now, I'll be disabling collision layers to temporarily disable collisions, but it can get more cumbersome when there are many entities on each layer and we only want to disable collision for certain entities, not all of them.
Do you know if exceptions on CharacterBody2D motion itself would cause performance issues? Or if it's just complicated to implement? Because if Shapecast2D exceptions just work, I may as well use it and manually move and slide my character based on the physics cast result - but it also means that CharacterBody2D move_and_slide may rely on existing implementation to allow exceptions.
Beta Was this translation helpful? Give feedback.
All reactions