diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-04-30 11:43:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-30 11:43:11 +0200 |
commit | f40c62fa29e8b08fe69487efa92fd08a3dea742c (patch) | |
tree | 233141d0d8b516ce95830fa898cba244fe29d350 /modules/bullet/collision_object_bullet.cpp | |
parent | 6ee5f7c8819847615c5e96ed92a2a86737350459 (diff) | |
parent | a9d4cde0f5abc399332dde0c7415b99a5796eb34 (diff) |
Merge pull request #27371 from ShyRed/fixdisabled2dcollisions
Allow adding disabled shapes
Diffstat (limited to 'modules/bullet/collision_object_bullet.cpp')
-rw-r--r-- | modules/bullet/collision_object_bullet.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index ef5f21fc21..3a90bdc6ae 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -216,8 +216,8 @@ RigidCollisionObjectBullet::~RigidCollisionObjectBullet() { } } -void RigidCollisionObjectBullet::add_shape(ShapeBullet *p_shape, const Transform &p_transform) { - shapes.push_back(ShapeWrapper(p_shape, p_transform, true)); +void RigidCollisionObjectBullet::add_shape(ShapeBullet *p_shape, const Transform &p_transform, bool p_disabled) { + shapes.push_back(ShapeWrapper(p_shape, p_transform, !p_disabled)); p_shape->add_owner(this); reload_shapes(); } @@ -299,6 +299,8 @@ Transform RigidCollisionObjectBullet::get_shape_transform(int p_index) const { } void RigidCollisionObjectBullet::set_shape_disabled(int p_index, bool p_disabled) { + if (shapes[p_index].active != p_disabled) + return; shapes.write[p_index].active = !p_disabled; shape_changed(p_index); } |