summaryrefslogtreecommitdiff
path: root/modules/bullet/bullet_physics_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bullet/bullet_physics_server.cpp')
-rw-r--r--modules/bullet/bullet_physics_server.cpp38
1 files changed, 23 insertions, 15 deletions
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 53a38967c3..7bc731e75e 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -74,12 +74,6 @@
body->get_space()->add_constraint(joint, joint->is_disabled_collisions_between_bodies());
// <--------------- Joint creation asserts
-btEmptyShape *BulletPhysicsServer::emptyShape(ShapeBullet::create_shape_empty());
-
-btEmptyShape *BulletPhysicsServer::get_empty_shape() {
- return emptyShape;
-}
-
void BulletPhysicsServer::_bind_methods() {
//ClassDB::bind_method(D_METHOD("DoTest"), &BulletPhysicsServer::DoTest);
}
@@ -89,9 +83,7 @@ BulletPhysicsServer::BulletPhysicsServer() :
active(true),
active_spaces_count(0) {}
-BulletPhysicsServer::~BulletPhysicsServer() {
- bulletdelete(emptyShape);
-}
+BulletPhysicsServer::~BulletPhysicsServer() {}
RID BulletPhysicsServer::shape_create(ShapeType p_shape) {
ShapeBullet *shape = NULL;
@@ -338,7 +330,7 @@ Transform BulletPhysicsServer::area_get_shape_transform(RID p_area, int p_shape_
void BulletPhysicsServer::area_remove_shape(RID p_area, int p_shape_idx) {
AreaBullet *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
- return area->remove_shape(p_shape_idx);
+ return area->remove_shape_full(p_shape_idx);
}
void BulletPhysicsServer::area_clear_shapes(RID p_area) {
@@ -346,7 +338,7 @@ void BulletPhysicsServer::area_clear_shapes(RID p_area) {
ERR_FAIL_COND(!area);
for (int i = area->get_shape_count(); 0 < i; --i)
- area->remove_shape(0);
+ area->remove_shape_full(0);
}
void BulletPhysicsServer::area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) {
@@ -567,7 +559,7 @@ void BulletPhysicsServer::body_remove_shape(RID p_body, int p_shape_idx) {
RigidBodyBullet *body = rigid_body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->remove_shape(p_shape_idx);
+ body->remove_shape_full(p_shape_idx);
}
void BulletPhysicsServer::body_clear_shapes(RID p_body) {
@@ -1479,6 +1471,22 @@ bool BulletPhysicsServer::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis
return generic_6dof_joint->get_flag(p_axis, p_flag);
}
+void BulletPhysicsServer::generic_6dof_joint_set_precision(RID p_joint, int p_precision) {
+ JointBullet *joint = joint_owner.get(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_6DOF);
+ Generic6DOFJointBullet *generic_6dof_joint = static_cast<Generic6DOFJointBullet *>(joint);
+ generic_6dof_joint->set_precision(p_precision);
+}
+
+int BulletPhysicsServer::generic_6dof_joint_get_precision(RID p_joint) {
+ JointBullet *joint = joint_owner.get(p_joint);
+ ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, 0);
+ Generic6DOFJointBullet *generic_6dof_joint = static_cast<Generic6DOFJointBullet *>(joint);
+ return generic_6dof_joint->get_precision();
+}
+
void BulletPhysicsServer::free(RID p_rid) {
if (shape_owner.owns(p_rid)) {
@@ -1486,7 +1494,7 @@ void BulletPhysicsServer::free(RID p_rid) {
// Notify the shape is configured
for (Map<ShapeOwnerBullet *, int>::Element *element = shape->get_owners().front(); element; element = element->next()) {
- static_cast<ShapeOwnerBullet *>(element->key())->remove_shape(shape);
+ static_cast<ShapeOwnerBullet *>(element->key())->remove_shape_full(shape);
}
shape_owner.free(p_rid);
@@ -1497,7 +1505,7 @@ void BulletPhysicsServer::free(RID p_rid) {
body->set_space(NULL);
- body->remove_all_shapes(true);
+ body->remove_all_shapes(true, true);
rigid_body_owner.free(p_rid);
bulletdelete(body);
@@ -1517,7 +1525,7 @@ void BulletPhysicsServer::free(RID p_rid) {
area->set_space(NULL);
- area->remove_all_shapes(true);
+ area->remove_all_shapes(true, true);
area_owner.free(p_rid);
bulletdelete(area);