summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorTristan Porteries <tristan@upbge.org>2018-07-10 12:50:14 +0000
committerPorteries Tristan <republicthunderbolt9@gmail.com>2018-08-16 16:58:15 +0200
commite5bfa98d0fa6a1acb1d385534c51b8006ef64142 (patch)
tree3da6e820e9564b7b8a710f6af74659e4ba880655 /servers
parentb01f036fb4dedaa3e0d9b36360ef08f706007a32 (diff)
Expose bullet shape margin to UI.
The margin value is exposed into the UI for shape ressource. This value can be modified through set_margin and get from get_margin or by using the property margin. Each time the margin is modified the associated collision shape is recreated and the margin value is used in ShapeBullet::prepare.
Diffstat (limited to 'servers')
-rw-r--r--servers/physics/physics_server_sw.cpp8
-rw-r--r--servers/physics/physics_server_sw.h4
-rw-r--r--servers/physics_server.h4
3 files changed, 16 insertions, 0 deletions
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index f2dbb635f8..7a2d773944 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -119,6 +119,13 @@ Variant PhysicsServerSW::shape_get_data(RID p_shape) const {
return shape->get_data();
};
+void PhysicsServerSW::shape_set_margin(RID p_shape, real_t p_margin) {
+}
+
+real_t PhysicsServerSW::shape_get_margin(RID p_shape) const {
+ return 0.0;
+}
+
real_t PhysicsServerSW::shape_get_custom_solver_bias(RID p_shape) const {
const ShapeSW *shape = shape_owner.get(p_shape);
@@ -287,6 +294,7 @@ void PhysicsServerSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
area->set_shape(p_shape_idx, shape);
}
+
void PhysicsServerSW::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform) {
AreaSW *area = area_owner.get(p_area);
diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h
index 3f56ba26d0..c2a4744757 100644
--- a/servers/physics/physics_server_sw.h
+++ b/servers/physics/physics_server_sw.h
@@ -85,6 +85,10 @@ public:
virtual ShapeType shape_get_type(RID p_shape) const;
virtual Variant shape_get_data(RID p_shape) const;
+
+ virtual void shape_set_margin(RID p_shape, real_t p_margin);
+ virtual real_t shape_get_margin(RID p_shape) const;
+
virtual real_t shape_get_custom_solver_bias(RID p_shape) const;
/* SPACE API */
diff --git a/servers/physics_server.h b/servers/physics_server.h
index 6712bee8dc..f8e7e694f6 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -240,6 +240,10 @@ public:
virtual ShapeType shape_get_type(RID p_shape) const = 0;
virtual Variant shape_get_data(RID p_shape) const = 0;
+
+ virtual void shape_set_margin(RID p_shape, real_t p_margin) = 0;
+ virtual real_t shape_get_margin(RID p_shape) const = 0;
+
virtual real_t shape_get_custom_solver_bias(RID p_shape) const = 0;
/* SPACE API */