aboutsummaryrefslogtreecommitdiff
path: root/servers/physics/physics_server_sw.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2017-11-09 16:08:58 -0300
committerGitHub2017-11-09 16:08:58 -0300
commit50a9bd4e23e62579e2249de3c27624d6c56df1d0 (patch)
treea0595c5872054a9d4fe50bc5446cea5518b5f8b0 /servers/physics/physics_server_sw.cpp
parent881defa209435816f52b08edfd876159592e830a (diff)
parent10f879bf883ed364a9b0eafe40aba03c59b6fbfb (diff)
downloadgodot-50a9bd4e23e62579e2249de3c27624d6c56df1d0.tar.gz
godot-50a9bd4e23e62579e2249de3c27624d6c56df1d0.tar.zst
godot-50a9bd4e23e62579e2249de3c27624d6c56df1d0.zip
Merge pull request #12713 from AndreaCatania/master
Rewritten kinematic system
Diffstat (limited to '')
-rw-r--r--servers/physics/physics_server_sw.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index 5ba935d47..ce63d8461 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -695,6 +695,19 @@ real_t PhysicsServerSW::body_get_param(RID p_body, BodyParameter p_param) const
return body->get_param(p_param);
};
+void PhysicsServerSW::body_set_kinematic_safe_margin(RID p_body, real_t p_margin) {
+ BodySW *body = body_owner.get(p_body);
+ ERR_FAIL_COND(!body);
+ body->set_kinematic_margin(p_margin);
+}
+
+real_t PhysicsServerSW::body_get_kinematic_safe_margin(RID p_body) const {
+ BodySW *body = body_owner.get(p_body);
+ ERR_FAIL_COND_V(!body, 0);
+
+ return body->get_kinematic_margin();
+}
+
void PhysicsServerSW::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) {
BodySW *body = body_owner.get(p_body);
@@ -888,7 +901,7 @@ bool PhysicsServerSW::body_is_ray_pickable(RID p_body) const {
return body->is_ray_pickable();
}
-bool PhysicsServerSW::body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, float p_margin, MotionResult *r_result) {
+bool PhysicsServerSW::body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, MotionResult *r_result) {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND_V(!body, false);
@@ -897,7 +910,7 @@ bool PhysicsServerSW::body_test_motion(RID p_body, const Transform &p_from, cons
_update_shapes();
- return body->get_space()->test_body_motion(body, p_from, p_motion, p_margin, r_result);
+ return body->get_space()->test_body_motion(body, p_from, p_motion, body->get_kinematic_margin(), r_result);
}
PhysicsDirectBodyState *PhysicsServerSW::body_get_direct_state(RID p_body) {