`Shape not found` error when assign polygon to CollisionPolygon2D after update to version 0.8.7
Describe the bug
It worked fine before I updated it to the new version.
To Reproduce
class_name RigidBodyGenerator
extends RigidBody2D
@onready var sprite = $Sprite2D
func _ready() -> void:
var bitmap = BitMap.new()
bitmap.create_from_image_alpha(sprite.texture.get_image())
var polys = bitmap.opaque_to_polygons(Rect2(Vector2.ZERO, sprite.texture.get_size()), 0.5)
for poly in polys:
var collision_polygon = CollisionPolygon2D.new()
collision_polygon.build_mode = CollisionPolygon2D.BUILD_SEGMENTS
collision_polygon.polygon = poly
add_child(collision_polygon)
# Generated polygon will not take into account the half-width and half-height offset
# of the image when "centered" is on. So move it backwards by this amount so it lines up.
if sprite.centered:
var half_size = bitmap.get_size() / 2
collision_polygon.position -= Vector2(half_size.x, half_size.y)
Expected behavior
No errors.
Environment:
- OS: Windows
- Version: 0.8.7
- Godot Version: 4.3
- Type: 2d
Example project(zip)
Can you also try in 0.8.8?
Can you also try in 0.8.8?
I tried it in version 0.8.8 and the errors disappeared, but the collide behavior is different from before. Is that normal?
This is the old one:
Ok, so now errors dissapear but the behaviour seems wrong. Will investigate the behaviour for collisions.
I'm receiving this as well in 0.8.8 and 0.8.9
src\shapes\rapier_convex_polygon_shape.rs:111 - ConvexPolygon shape points changed from size 6 to 0
src\rapier_wrapper\shape.rs:296 - Shape not found
src\shapes\rapier_convex_polygon_shape.rs:111 - ConvexPolygon shape points changed from size 6 to 0
src\rapier_wrapper\shape.rs:296 - Shape not found
No longer spams errors, fixed. Reopen if still happens. It lags a bit but each shape has way too many vertices.
So there's kind of two bugs here-- one was the error spam, the other was the extra contact points showing up. The error spam is gone now, and the other bug was fixed by https://github.com/appsinacup/godot-rapier-physics/pull/412