Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | henriquelalves | |
Old Version | Published before Godot 3 was released. |
I’ll explain my setup first.
There is an enemy in the game I’m creating that simply runs towards the player; but while it is running, it must check for collisions with other enemies (the player can intersect enemies so they’ll hit each other and die) and with the player himself, without ACTUALLY physically colliding (I want it to overlay the player when he reaches it - the enemy is kind of “invencible” while it is running). But after the enemy reaches his final position, it must stop - than I’ll treat it as a normal Physical object that the player can’t get through.
I thought this would be a simple thing to create by using the Trigger option on the Kinematic Body, as I would just temporarily disable the Physics of the object while it is running but would still get the Collisions triggers; but as I experienced (same problem in CollisionShape2D trigger doesn't behave as expected · Issue #4393 · godotengine/godot · GitHub), the Trigger option doesn’t work for this exactly. So now I had to create a new Area2D node inside my Enemy scene, in which I would have another CollisionShape2D (the same as the KinematicBody shape), only to test if there is another area intersection with. Is there any other, more optimal way to just temporarily disable the physics of an object while still getting the collision triggers? I don’t like the current setup, but I didn’t found anything new on the PhysicsBody documentation that I can use.