Exemple #1
0
Body2DSW::Body2DSW() : CollisionObject2DSW(TYPE_BODY), active_list(this), inertia_update_list(this), direct_state_query_list(this) {


	mode=Physics2DServer::BODY_MODE_RIGID;
	active=true;
	angular_velocity=0;
	biased_angular_velocity=0;
	mass=1;
	_inv_inertia=0;
	_inv_mass=1;
	bounce=0;
	friction=1;
	omit_force_integration=false;
	applied_torque=0;
	island_step=0;
	island_next=NULL;
	island_list_next=NULL;
	_set_static(false);
	first_time_kinematic=false;
	linear_damp=-1;
	angular_damp=-1;
	area_angular_damp=0;
	area_linear_damp=0;
	contact_count=0;
	gravity_scale=1.0;
	using_one_way_cache=false;
	one_way_collision_max_depth=0.1;

	still_time=0;
	continuous_cd_mode=Physics2DServer::CCD_MODE_DISABLED;
	can_sleep=false;
	fi_callback=NULL;

}
Exemple #2
0
BodySW::BodySW() : CollisionObjectSW(TYPE_BODY), active_list(this), inertia_update_list(this), direct_state_query_list(this) {


	mode=PhysicsServer::BODY_MODE_RIGID;
	active=true;

	mass=1;
//	_inv_inertia=Transform();
	_inv_mass=1;
	bounce=0;
	friction=1;
	omit_force_integration=false;
//	applied_torque=0;
	island_step=0;
	island_next=NULL;
	island_list_next=NULL;
	first_time_kinematic=false;
	first_integration=false;
	_set_static(false);

	contact_count=0;
	gravity_scale=1.0;

	area_angular_damp=0;
	area_linear_damp=0;

	still_time=0;
	continuous_cd=false;
	can_sleep=false;
	fi_callback=NULL;
	axis_lock=PhysicsServer::BODY_AXIS_LOCK_DISABLED;

}
Exemple #3
0
void Area2DSW::set_monitorable(bool p_monitorable) {

	if (monitorable==p_monitorable)
		return;

	monitorable=p_monitorable;
	_set_static(!monitorable);
}
Exemple #4
0
void BodySW::set_mode(PhysicsServer::BodyMode p_mode) {

	PhysicsServer::BodyMode prev = mode;
	mode = p_mode;

	switch (p_mode) {
		//CLEAR UP EVERYTHING IN CASE IT NOT WORKS!
		case PhysicsServer::BODY_MODE_STATIC:
		case PhysicsServer::BODY_MODE_KINEMATIC: {

			_set_inv_transform(get_transform().affine_inverse());
			_inv_mass = 0;
			_set_static(p_mode == PhysicsServer::BODY_MODE_STATIC);
			//set_active(p_mode==PhysicsServer::BODY_MODE_KINEMATIC);
			set_active(p_mode == PhysicsServer::BODY_MODE_KINEMATIC && contacts.size());
			linear_velocity = Vector3();
			angular_velocity = Vector3();
			if (mode == PhysicsServer::BODY_MODE_KINEMATIC && prev != mode) {
				first_time_kinematic = true;
			}

		} break;
		case PhysicsServer::BODY_MODE_RIGID: {

			_inv_mass = mass > 0 ? (1.0 / mass) : 0;
			_set_static(false);

		} break;
		case PhysicsServer::BODY_MODE_CHARACTER: {

			_inv_mass = mass > 0 ? (1.0 / mass) : 0;
			_set_static(false);
		} break;
	}

	_update_inertia();
	/*
	if (get_space())
		_update_queries();
	*/
}
Exemple #5
0
AreaSW::AreaSW() : CollisionObjectSW(TYPE_AREA), monitor_query_list(this),  moved_list(this) {

	_set_static(true); //areas are never active
	space_override_mode=PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED;
	gravity=9.80665;
	gravity_vector=Vector3(0,-1,0);
	gravity_is_point=false;
	point_attenuation=1;
	density=0.1;
	priority=0;
	ray_pickable=false;


}
Exemple #6
0
AreaSW::AreaSW()
	: CollisionObjectSW(TYPE_AREA), monitor_query_list(this), moved_list(this) {

	_set_static(true); //areas are never active
	space_override_mode = PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED;
	gravity = 9.80665;
	gravity_vector = Vector3(0, -1, 0);
	gravity_is_point = false;
	gravity_distance_scale = 0;
	point_attenuation = 1;
	angular_damp = 1.0;
	linear_damp = 0.1;
	priority = 0;
	set_ray_pickable(false);
	monitor_callback_id = 0;
	area_monitor_callback_id = 0;
	monitorable = false;
}