From 247e7ed716a4c0bd5140c2b2a938f7118e84fb14 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 2 Sep 2014 23:13:40 -0300 Subject: 3D Physics and Other Stuff -=-=-=-=-=-=-=-=-=-=-=-=-= -New Vehicle (Based on Bullet's RaycastVehicle) - Vehiclebody/VehicleWheel. Demo will come soon, old vehicle (CarBody) will go away soon too. -A lot of fixes to the 3D physics engine -Added KinematicBody with demo -Fixed the space query API for 2D (demo will come soon). 3D is WIP. -Fixed long-standing bug with body_enter/body_exit for Area and Area2D -Performance variables now includes physics (active bodies, collision pairs and islands) -Ability to see what's inside of instanced scenes! -Fixed Blend Shapes (no bs+skeleton yet) -Added an Android JavaClassWrapper singleton for using Android native classes directly from GDScript. This is very Alpha! --- servers/physics/body_pair_sw.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'servers/physics/body_pair_sw.cpp') diff --git a/servers/physics/body_pair_sw.cpp b/servers/physics/body_pair_sw.cpp index c50bfac472..3c838367c2 100644 --- a/servers/physics/body_pair_sw.cpp +++ b/servers/physics/body_pair_sw.cpp @@ -29,7 +29,7 @@ #include "body_pair_sw.h" #include "collision_solver_sw.h" #include "space_sw.h" - +#include "os/os.h" /* #define NO_ACCUMULATE_IMPULSES @@ -174,6 +174,11 @@ void BodyPairSW::validate_contacts() { bool BodyPairSW::setup(float p_step) { + //cannot collide + if (A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode()<=PhysicsServer::BODY_MODE_KINEMATIC && B->get_mode()<=PhysicsServer::BODY_MODE_KINEMATIC)) { + collided=false; + return false; + } offset_B = B->get_transform().get_origin() - A->get_transform().get_origin(); @@ -197,10 +202,6 @@ bool BodyPairSW::setup(float p_step) { return false; - //cannot collide - if (A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode()<=PhysicsServer::BODY_MODE_KINEMATIC && B->get_mode()<=PhysicsServer::BODY_MODE_KINEMATIC)) { - return false; - } real_t max_penetration = space->get_contact_max_allowed_penetration(); @@ -217,6 +218,7 @@ bool BodyPairSW::setup(float p_step) { } + real_t inv_dt = 1.0/p_step; for(int i=0;i