Esempio n. 1
0
void PhysicsServerSW::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) {

	BodySW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	ERR_FAIL_INDEX(p_shape_idx, body->get_shape_count());
	body->set_shape_as_disabled(p_shape_idx, p_disabled);
}
Esempio n. 2
0
int PhysicsServerSW::body_get_shape_count(RID p_body) const {

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

	return body->get_shape_count();
}
Esempio n. 3
0
Transform PhysicsServerSW::body_get_shape_transform(RID p_body, int p_shape_idx) const {

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

	return body->get_shape_transform(p_shape_idx);
}
Esempio n. 4
0
bool PhysicsServerSW::body_is_ray_pickable(RID p_body) const{

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

}
Esempio n. 5
0
bool PhysicsServerSW::body_is_continuous_collision_detection_enabled(RID p_body) const {

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

	return body->is_continuous_collision_detection_enabled();
}
Esempio n. 6
0
void PhysicsServerSW::body_add_torque(RID p_body, const Vector3 &p_torque) {
	BodySW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);

	body->add_torque(p_torque);
	body->wakeup();
};
Esempio n. 7
0
void PhysicsServerSW::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) {

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

	body->set_state(p_state, p_variant);
};
Esempio n. 8
0
void PhysicsServerSW::body_remove_shape(RID p_body, int p_shape_idx) {

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

	body->remove_shape(p_shape_idx);
}
Esempio n. 9
0
void PhysicsServerSW::body_set_omit_force_integration(RID p_body,bool p_omit) {

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

	body->set_omit_force_integration(p_omit);
};
Esempio n. 10
0
PhysicsServer::BodyMode PhysicsServerSW::body_get_mode(RID p_body) const {

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

	return body->get_mode();
};
Esempio n. 11
0
void PhysicsServerSW::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform& p_transform) {

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

	body->set_shape_transform(p_shape_idx,p_transform);
}
Esempio n. 12
0
void PhysicsServerSW::body_set_mode(RID p_body, BodyMode p_mode) {

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

	body->set_mode(p_mode);
};
Esempio n. 13
0
void PhysicsServerSW::body_attach_object_instance_id(RID p_body, uint32_t p_ID) {

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

	body->set_instance_id(p_ID);
};
Esempio n. 14
0
uint32_t PhysicsServerSW::body_get_object_instance_ID(RID p_body) const {

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

	return body->get_instance_id();
};
Esempio n. 15
0
Vector3 PhysicsServerSW::body_get_applied_torque(RID p_body) const {

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

	return body->get_applied_torque();
};
Esempio n. 16
0
Variant PhysicsServerSW::body_get_state(RID p_body, BodyState p_state) const {

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

	return body->get_state(p_state);
};
Esempio n. 17
0
void PhysicsServerSW::body_set_param(RID p_body, BodyParameter p_param, float p_value) {

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

	body->set_param(p_param,p_value);
};
Esempio n. 18
0
float PhysicsServerSW::body_get_param(RID p_body, BodyParameter p_param) const {

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

	return body->get_param(p_param);
};
Esempio n. 19
0
void PhysicsServerSW::body_set_ray_pickable(RID p_body,bool p_enable) {

	BodySW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	body->set_ray_pickable(p_enable);

}
Esempio n. 20
0
void PhysicsServerSW::body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) {

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

	body->set_continuous_collision_detection(p_enable);
}
Esempio n. 21
0
void StepSW::_populate_island(BodySW* p_body,BodySW** p_island,ConstraintSW **p_constraint_island) {

	p_body->set_island_step(_step);
	p_body->set_island_next(*p_island);
	*p_island=p_body;

	for(Map<ConstraintSW*,int>::Element *E=p_body->get_constraint_map().front();E;E=E->next()) {

		ConstraintSW *c=(ConstraintSW*)E->key();
		if (c->get_island_step()==_step)
			continue; //already processed
		c->set_island_step(_step);
		c->set_island_next(*p_constraint_island);
		*p_constraint_island=c;


		for(int i=0;i<c->get_body_count();i++) {
			if (i==E->get())
				continue;
			BodySW *b = c->get_body_ptr()[i];
			if (b->get_island_step()==_step || b->get_mode()==PhysicsServer::BODY_MODE_STATIC)
				continue; //no go
			_populate_island(c->get_body_ptr()[i],p_island,p_constraint_island);
		}
	}
}
Esempio n. 22
0
void PhysicsServerSW::body_remove_collision_exception(RID p_body, RID p_body_b) {

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

	body->remove_exception(p_body_b);
	body->wakeup();
};
Esempio n. 23
0
void PhysicsServerSW::body_set_axis_lock(RID p_body,BodyAxisLock p_lock) {

	BodySW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	body->set_axis_lock(p_lock);
	body->wakeup();

}
Esempio n. 24
0
void PhysicsServerSW::body_apply_impulse(RID p_body, const Vector3& p_pos, const Vector3& p_impulse) {

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

	body->apply_impulse(p_pos,p_impulse);
	body->wakeup();
};
Esempio n. 25
0
void PhysicsServerSW::body_set_applied_force(RID p_body, const Vector3& p_force) {

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

	body->set_applied_force(p_force);
	body->wakeup();
};
Esempio n. 26
0
void PhysicsServerSW::body_set_force_integration_callback(RID p_body,Object *p_receiver,const StringName& p_method,const Variant& p_udata) {


	BodySW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	body->set_force_integration_callback(p_receiver?p_receiver->get_instance_ID():ObjectID(0),p_method,p_udata);

}
Esempio n. 27
0
bool PhysicsServerSW::body_is_shape_set_as_trigger(RID p_body, int p_shape_idx) const{

	BodySW *body = body_owner.get(p_body);
	ERR_FAIL_COND_V(!body,false);
	ERR_FAIL_INDEX_V(p_shape_idx,body->get_shape_count(),false);

	return body->is_shape_set_as_trigger(p_shape_idx);
}
Esempio n. 28
0
void PhysicsServerSW::body_clear_shapes(RID p_body) {

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

	while (body->get_shape_count())
		body->remove_shape(0);
}
Esempio n. 29
0
void PhysicsServerSW::body_set_collision_mask(RID p_body, uint32_t p_mask) {

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

	body->set_collision_mask(p_mask);
	body->wakeup();
}
Esempio n. 30
0
void PhysicsServerSW::body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) {

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

	for (int i = 0; i < body->get_exceptions().size(); i++) {
		p_exceptions->push_back(body->get_exceptions()[i]);
	}
};