summaryrefslogtreecommitdiff
path: root/servers/physics_2d/physics_2d_server_sw.cpp
diff options
context:
space:
mode:
authorAndreaCatania <info@andreacatania.com>2017-09-29 17:33:30 +0200
committerAndreaCatania <info@andreacatania.com>2017-09-29 17:33:30 +0200
commitc56c67db39b619d37c503e41e718f9cda39c3f0e (patch)
tree2fa62c7103a09e3c0b2baeface159613ae6d5cba /servers/physics_2d/physics_2d_server_sw.cpp
parentdee100139008bd4dd8c270da6a7f5aa326a32c25 (diff)
Added new API to get body direct state
Diffstat (limited to 'servers/physics_2d/physics_2d_server_sw.cpp')
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index e9e7122af3..a9ed79ec22 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -954,6 +954,21 @@ bool Physics2DServerSW::body_test_motion(RID p_body, const Transform2D &p_from,
return body->get_space()->test_body_motion(body, p_from, p_motion, p_margin, r_result);
}
+Physics2DDirectBodyState *Physics2DServerSW::body_get_direct_state(RID p_body) {
+
+ Body2DSW *body = body_owner.get(p_body);
+ ERR_FAIL_COND_V(!body, NULL);
+
+ if ((using_threads && !doing_sync) || body->get_space()->is_locked()) {
+
+ ERR_EXPLAIN("Body state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_V(NULL);
+ }
+
+ direct_state->body = body;
+ return direct_state;
+}
+
/* JOINT API */
void Physics2DServerSW::joint_set_param(RID p_joint, JointParam p_param, real_t p_value) {