You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With RB2D and collisionshape2D created in the editor, adjusting the properties of the collisionshape2D shape with code breaks signalling for TileMap collisions. Signals like body_entered, body_shape_entered no longer trigger from the RigidBody2D for TileMap, TileMapLayer or other RigidBody2D collisions, although the physics still works. It does however still trigger for CharacterBody2D's.
In this particular instance, the collision shape is a CircleShape2D added to the RB2D in the editor and the radius is set on _ready(). Even if the radius is set to the same radius as it already is the behaviour is evident.
Creating the collision shape and then setting the property at runtime avoids this issue.
Not touching the properties with code avoids this issue.
Using godot built-in physics avoids this issue.
To Reproduce
New scene Node2D.
Add TileMapLayer, configure configure physics, add a short horizontal line of physics enabled tiles.
Add RigidBody2D and CollisionShape2D Circle Shape.
Set Solver > Contact Monitor to ON and Max reported contacts to 1
On RigidBody2D add script;
extends RigidBody2D
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
func _ready() -> void:
var circle_shape = collision_shape_2d.shape as CircleShape2D
circle_shape.radius = circle_shape.radius
connect("body_shape_entered", Callable(_on_body_shape_entered))
func _on_body_shape_entered(_body_rid: RID, body: Node, _body_shape_index: int, _local_shape_index: int):
print(self.name, " hit ", body.name)
Add another RigidBody2D, but don't create or assign a collisionShape.
Add script to the second RB2D;
Place the two RigidBody's above the tilemap and enable gravity for both.
Expected behavior
RigidBody2D should trigger body_entered and body_shape_entered signals for all collisions with collisionshapes including tilemaps and tilemaplayers even if the properties of a collision shape originally added in the editor are adjusted during runtime.
Description
With RB2D and collisionshape2D created in the editor, adjusting the properties of the collisionshape2D shape with code breaks signalling for TileMap collisions. Signals like body_entered, body_shape_entered no longer trigger from the RigidBody2D for TileMap, TileMapLayer or other RigidBody2D collisions, although the physics still works. It does however still trigger for CharacterBody2D's.
In this particular instance, the collision shape is a CircleShape2D added to the RB2D in the editor and the radius is set on _ready(). Even if the radius is set to the same radius as it already is the behaviour is evident.
Creating the collision shape and then setting the property at runtime avoids this issue.
Not touching the properties with code avoids this issue.
Using godot built-in physics avoids this issue.
To Reproduce
New scene Node2D.
Add TileMapLayer, configure configure physics, add a short horizontal line of physics enabled tiles.
Add RigidBody2D and CollisionShape2D Circle Shape.
Set Solver > Contact Monitor to ON and Max reported contacts to 1
On RigidBody2D add script;
Add another RigidBody2D, but don't create or assign a collisionShape.
Add script to the second RB2D;
Place the two RigidBody's above the tilemap and enable gravity for both.
Expected behavior
RigidBody2D should trigger body_entered and body_shape_entered signals for all collisions with collisionshapes including tilemaps and tilemaplayers even if the properties of a collision shape originally added in the editor are adjusted during runtime.
Environment:
Example project(zip)
Uploading rapier_RB2D_repro.zip…
Please attach a zip with project where issue occurs. Remove the addons folder so that the size is less than 25 mb.
The text was updated successfully, but these errors were encountered: