From 7bbd5454329e483c67f51dba960213da930bda1d Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Thu, 11 Mar 2021 18:15:31 -0700 Subject: Disable backface collision with ConcavePolygonShape by default Helps a lot with soft bodies and generally useful to avoid shapes to go through the ground in certain cases. Added an option in ConcavePolygonShape to re-enable backface collision on specific bodies if needed. --- modules/bullet/shape_bullet.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules/bullet') diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index 82876ab77c..471b154813 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -375,11 +375,17 @@ ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() { } void ConcavePolygonShapeBullet::set_data(const Variant &p_data) { - setup(p_data); + Dictionary d = p_data; + ERR_FAIL_COND(!d.has("faces")); + + setup(d["faces"]); } Variant ConcavePolygonShapeBullet::get_data() const { - return faces; + Dictionary d; + d["faces"] = faces; + + return d; } PhysicsServer3D::ShapeType ConcavePolygonShapeBullet::get_type() const { -- cgit v1.2.3