diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-10-03 08:58:41 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-10-03 08:58:41 -0300 |
commit | af4a97bef9bfb06e2737ad709dde157688a94daf (patch) | |
tree | d3c6471da30a8d6c20d10858e78907edd9c886e8 /servers/physics_2d/body_2d_sw.cpp | |
parent | 1b3a10891ebdc6e76a81c8915ba08065311e17d3 (diff) |
missing fils from yesterday comit.
must have made some mistake with git,
not sure why they were not sent..
Diffstat (limited to 'servers/physics_2d/body_2d_sw.cpp')
-rw-r--r-- | servers/physics_2d/body_2d_sw.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index f10cdadf4e..e90faa3efb 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -186,7 +186,7 @@ void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) { _set_inv_transform(get_transform().affine_inverse()); _inv_mass=0; _set_static(p_mode==Physics2DServer::BODY_MODE_STATIC); - //set_active(p_mode==Physics2DServer::BODY_MODE_KINEMATIC); + set_active(p_mode==Physics2DServer::BODY_MODE_KINEMATIC && contacts.size()); linear_velocity=Vector2(); angular_velocity=0; } break; @@ -385,10 +385,10 @@ void Body2DSW::integrate_forces(real_t p_step) { motion = new_transform.elements[2] - get_transform().elements[2]; do_motion=true; - for(int i=0;i<get_shape_count();i++) { - set_shape_kinematic_advance(i,Vector2()); - set_shape_kinematic_retreat(i,0); - } + //for(int i=0;i<get_shape_count();i++) { + // set_shape_kinematic_advance(i,Vector2()); + // set_shape_kinematic_retreat(i,0); + //} } else { if (!omit_force_integration) { @@ -434,7 +434,7 @@ void Body2DSW::integrate_forces(real_t p_step) { } current_area=NULL; // clear the area, so it is set in the next frame - contact_count=0; + contact_count=0; } @@ -449,8 +449,8 @@ void Body2DSW::integrate_velocities(real_t p_step) { if (mode==Physics2DServer::BODY_MODE_KINEMATIC) { _set_transform(new_transform,false); - _set_inv_transform(new_transform.affine_inverse()); ; - if (linear_velocity==Vector2() && angular_velocity==0) + _set_inv_transform(new_transform.affine_inverse()); + if (contacts.size()==0 && linear_velocity==Vector2() && angular_velocity==0) set_active(false); //stopped moving, deactivate return; } @@ -507,6 +507,7 @@ void Body2DSW::call_queries() { Variant v=dbs; const Variant *vp[2]={&v,&fi_callback->callback_udata}; + Object *obj = ObjectDB::get_instance(fi_callback->id); if (!obj) { |