diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-02-13 15:26:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-13 15:26:04 +0100 |
commit | eefb58a892dfd5f334cbc86522a1cf0763af77d3 (patch) | |
tree | 26451b667bdfe48006d98e1502a11738875c63b0 /modules/bullet/constraint_bullet.cpp | |
parent | fd871b4d4f0b4441681a3f0c351058be5834b9dc (diff) | |
parent | a42765dadad77d4f4893d9ccf73b7cfefc1643bd (diff) |
Merge pull request #16424 from AndreaCatania/phyj
Added physics API in order to enable/disable collisions between rigidbody attached to a joint with bullet physics bullet
Diffstat (limited to 'modules/bullet/constraint_bullet.cpp')
-rw-r--r-- | modules/bullet/constraint_bullet.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/bullet/constraint_bullet.cpp b/modules/bullet/constraint_bullet.cpp index b60e89b6fd..d15fb8de01 100644 --- a/modules/bullet/constraint_bullet.cpp +++ b/modules/bullet/constraint_bullet.cpp @@ -39,7 +39,8 @@ ConstraintBullet::ConstraintBullet() : space(NULL), - constraint(NULL) {} + constraint(NULL), + disabled_collisions_between_bodies(true) {} void ConstraintBullet::setup(btTypedConstraint *p_constraint) { constraint = p_constraint; @@ -53,3 +54,12 @@ void ConstraintBullet::set_space(SpaceBullet *p_space) { void ConstraintBullet::destroy_internal_constraint() { space->remove_constraint(this); } + +void ConstraintBullet::disable_collisions_between_bodies(const bool p_disabled) { + disabled_collisions_between_bodies = p_disabled; + + if (space) { + space->remove_constraint(this); + space->add_constraint(this, disabled_collisions_between_bodies); + } +} |