-
-
Notifications
You must be signed in to change notification settings - Fork 19.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Area3D does not detect body_entered
on StaticBody3D and RigidBody3D
#74300
Comments
Related #66468 |
Have you set the area to monitorable? |
Yes |
For those of you who want an hack against this bug, constantly changing the collision layer if you're using an func _physics_process(delta):
# Considering "area" an Area3D, and layer 32 an unused layer
area.set_collision_layer_value(32, not area.get_collision_layer_value(32)) However it doesn't work if you're using servers for some reason, in which case it seems like only changing the monitorable property works: func _called_every_physics_frame():
# Considering "area" a RID pointing to a PhysicsServer3D area
# Changing twice to ensure the monitorable property stays constant
# If you want the area to be not monitorable, just swap places of the two lines of code
PhysicsServer3D.area_set_monitorable(area, false)
PhysicsServer3D.area_set_monitorable(area, true) |
Also having this bug. |
I also can confirm this or at least a similar issue on @TamerSoup625's solution worked for me. I was using Disabling seems to work correctly, but re-enabling a StaticBody3D inside of the Area3D seems to not be registered correctly by the Area3D. Edit: The Area3D also was not moving. So none of the objects in my scene was moving. |
Same issue with RigidBody3D entering an Area3D on Mac in Godot 4.1 |
I also ran into this issue with Godot .NET 4.1.2. I can confirm the Area3D works in the very first _PhysicsProcess step, but it does not report anything else during lifetime / doesn't detect any changes. |
Re the workaround by setting monitorable / collision mask - #74300 (comment) Just discovered that neither of these work with Godot-jolt physics, and it has the same issue |
I'm piping in to add that this has been present since 4.0 at least. I don't believe it is limited to a certain type of node since this happened to me with a skeletal system inside a Node2D. I for whatever reason tried to change the root node to AnimationPlayer and poof the rig was gone. I learned not to change note types it's better to just create a brand new one. It is definitely a bug. This has been reported before and I think I commented on that one too. |
body_entered
on StaticBody3D and RigidBody3D
Using Godot 4.2 Beta 6 and I'm having the same issue. |
This made its way into 4.2 Stable 2023-12-03.15-05-09.mp4Same Scene With 2023-12-03.15-05-38.mp4 |
I have a similar situation in that I'm using a CharacterBody3d. During testing, when my CharacterBody3d isn't moving, the signal body_entered isn't triggered. When I put movement, then its triggered. Or similarly if it starts with the CharacterBody3d inside the Aread3d, then it is triggered as well |
I'm on 4.2.1 [b08f793f5] Windows 11 Home and experiencing this issue. None of the fixes above worked for me. (detecting a RigidBody3D entering an static Area3D). The only way I could get it to work is to jiggle the area 3d a tiny amount each _physics_process: @onready var pos = global_position func _physics_process(delta: float) -> void: |
I just tested this with nox123 MRP in Godot 4.2.1 stable and 4.3 dev2 on Windows and can confirm the StaticBody3D issue, however RigidBody3D (and CharacterBody3D) seems to work as expected. I also tested different collision shape (BoxShape3D), but that did not any a difference. |
I am also getting this bug in 4.2 but only when I preload a packed scene and then programmatically instantiate it at runtime. Doesn't matter if it is instantiated in If I manually bring in an instance of that packed scene into my scene, the area3D signals work fine. This may strongly hint that something is not getting initialized with the layers/masks/etc when being done programmatically. Edit: but I should note that @TamerSoup625's suggestion above does not appear to fix it in this case (could be due to Jolt, however)... could be multiple bugs Edit 2: figured out my problem (not an engine bug), but leaving this comment here because it may help someone else. My Area3D needed to be inside my RigidBody3D, because physics was acting on it and moving the object around. If the area3D is outside the RigidBody3D, then it gets "left behind" as the object moves. |
Got this issue with CharacterBody3D, after disabling the process mode(with Disable mode set to Remove) then reenabling it, and only rarely. Switching to Jolt-physics did not resolve it for me. Using 4.2.1 stable Following this did make it work for me, with Jolt too: |
You have to enable an option in Jolt settings. Took me 2 hours to find out. |
Having this issue too, Godot 4.2.1 stable on Linux, not using Jolt. |
If you come by this and are spawning an Area3D to verify if it has a body inside it, the Area3D only sees what enter or exits of it, if you want to detect all bodies in a area (ex: during an explosion, searching all damageable bodies on that frame), you can check directly on the Physics server using: var space := get_world_3d().direct_space_state
var search = PhysicsShapeQueryParameters3D.new()
search.transform = global_transform
var shape = SphereShape3D.new()
shape.radius = 4
search.shape = shape
var bodies = space.intersect_shape(search) Check the docs on PhysicsDirectSpaceState3D for more details. |
For me it does not work only between instance of the same scene. |
still happening in 4.3 beta 1. i'm happy to try to fix this but don't know where to start |
Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.
Godot version
Godot Engine v4.0.stable.official.92bee43ad
System information
Vulkan API 1.2.231 - Forward Mobile - Using Vulkan Device #0: Apple - Apple M1 Max
Issue description
Area3d not detect (or send signal) body_entered when BODY is StaticBody3d or RigidBody3d
it's detecting this object only when SB or RB starts in the area
CharacterBody3D is different case it is detected when it's entered, so it works properly
Steps to reproduce
-create Area3d with big colisionShape
Minimal reproduction project
Area3dBug.zip
The text was updated successfully, but these errors were encountered: