Merge pull request #11702 from AndreaCatania/bodyDS

Added new API to get body direct state
This commit is contained in:
Rémi Verschelde 2017-10-09 11:01:36 +02:00 committed by GitHub
commit 8e9b99fe59
9 changed files with 53 additions and 0 deletions

View file

@ -914,6 +914,21 @@ bool PhysicsServerSW::body_test_motion(RID p_body, const Transform &p_from, cons
return body->get_space()->test_body_motion(body, p_from, p_motion, p_margin, r_result);
}
PhysicsDirectBodyState *PhysicsServerSW::body_get_direct_state(RID p_body) {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND_V(!body, NULL);
if (!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 */
RID PhysicsServerSW::joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B) {