Example #1
0
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);
	ERR_FAIL_COND_V(!body->get_space(), false);
	ERR_FAIL_COND_V(body->get_space()->is_locked(), false);

	_update_shapes();

	return body->get_space()->test_body_motion(body, p_from, p_motion, body->get_kinematic_margin(), r_result);
}
int PhysicsServerSW::body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin) {

	BodySW *body = body_owner.get(p_body);
	ERR_FAIL_COND_V(!body, false);
	ERR_FAIL_COND_V(!body->get_space(), false);
	ERR_FAIL_COND_V(body->get_space()->is_locked(), false);

	_update_shapes();

	return body->get_space()->test_body_ray_separation(body, p_transform, p_infinite_inertia, r_recover_motion, r_results, p_result_max, p_margin);
}
Example #3
0
RID PhysicsServerSW::body_get_space(RID p_body) const {

	BodySW *body = body_owner.get(p_body);
	ERR_FAIL_COND_V(!body,RID());

	SpaceSW *space = body->get_space();
	if (!space)
		return RID();
	return space->get_self();
};
Example #4
0
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;
}
Example #5
0
void PhysicsServerSW::body_set_space(RID p_body, RID p_space) {

	BodySW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	SpaceSW *space=NULL;

	if (p_space.is_valid()) {
		space = space_owner.get(p_space);
		ERR_FAIL_COND(!space);
	}

	if (body->get_space()==space)
		return; //pointles

	body->set_space(space);

};