summaryrefslogtreecommitdiff
path: root/modules/bullet/constraint_bullet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bullet/constraint_bullet.cpp')
-rw-r--r--modules/bullet/constraint_bullet.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/modules/bullet/constraint_bullet.cpp b/modules/bullet/constraint_bullet.cpp
index 0c5ba29cb3..d15fb8de01 100644
--- a/modules/bullet/constraint_bullet.cpp
+++ b/modules/bullet/constraint_bullet.cpp
@@ -1,10 +1,9 @@
/*************************************************************************/
/* constraint_bullet.cpp */
-/* Author: AndreaCatania */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
@@ -30,12 +29,18 @@
/*************************************************************************/
#include "constraint_bullet.h"
+
#include "collision_object_bullet.h"
#include "space_bullet.h"
+/**
+ @author AndreaCatania
+*/
+
ConstraintBullet::ConstraintBullet() :
space(NULL),
- constraint(NULL) {}
+ constraint(NULL),
+ disabled_collisions_between_bodies(true) {}
void ConstraintBullet::setup(btTypedConstraint *p_constraint) {
constraint = p_constraint;
@@ -49,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);
+ }
+}