diff options
Diffstat (limited to 'servers/physics')
-rw-r--r-- | servers/physics/area_pair_sw.cpp | 2 | ||||
-rw-r--r-- | servers/physics/body_sw.cpp | 54 | ||||
-rw-r--r-- | servers/physics/collision_solver_sat.cpp | 24 | ||||
-rw-r--r-- | servers/physics/collision_solver_sw.cpp | 2 | ||||
-rw-r--r-- | servers/physics/joints/cone_twist_joint_sw.cpp | 4 | ||||
-rw-r--r-- | servers/physics/joints/generic_6dof_joint_sw.cpp | 29 | ||||
-rw-r--r-- | servers/physics/joints/hinge_joint_sw.cpp | 8 | ||||
-rw-r--r-- | servers/physics/joints/pin_joint_sw.cpp | 4 | ||||
-rw-r--r-- | servers/physics/physics_server_sw.cpp | 16 | ||||
-rw-r--r-- | servers/physics/physics_server_sw.h | 2 | ||||
-rw-r--r-- | servers/physics/shape_sw.cpp | 10 | ||||
-rw-r--r-- | servers/physics/shape_sw.h | 4 | ||||
-rw-r--r-- | servers/physics/space_sw.cpp | 6 | ||||
-rw-r--r-- | servers/physics/step_sw.cpp | 2 |
14 files changed, 96 insertions, 71 deletions
diff --git a/servers/physics/area_pair_sw.cpp b/servers/physics/area_pair_sw.cpp index 1131aa90d3..e95c85d751 100644 --- a/servers/physics/area_pair_sw.cpp +++ b/servers/physics/area_pair_sw.cpp @@ -110,7 +110,7 @@ bool Area2PairSW::setup(float p_step) { return false; } -// bool result = area_a->test_collision_mask(area_b) && CollisionSolverSW::solve(area_a->get_shape(shape_a),area_a->get_transform() * area_a->get_shape_transform(shape_a),Vector2(),area_b->get_shape(shape_b),area_b->get_transform() * area_b->get_shape_transform(shape_b),Vector2(),NULL,this); + //bool result = area_a->test_collision_mask(area_b) && CollisionSolverSW::solve(area_a->get_shape(shape_a),area_a->get_transform() * area_a->get_shape_transform(shape_a),Vector2(),area_b->get_shape(shape_b),area_b->get_transform() * area_b->get_shape_transform(shape_b),Vector2(),NULL,this); bool result = CollisionSolverSW::solve_static(area_a->get_shape(shape_a),area_a->get_transform() * area_a->get_shape_transform(shape_a),area_b->get_shape(shape_b),area_b->get_transform() * area_b->get_shape_transform(shape_b),NULL,this); if (result!=colliding) { diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index ceeeafe04a..81604dd5e1 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -270,8 +270,10 @@ void BodySW::set_mode(PhysicsServer::BodyMode p_mode) { } _update_inertia(); - //if (get_space()) -// _update_queries(); + /* + if (get_space()) + _update_queries(); + */ } PhysicsServer::BodyMode BodySW::get_mode() const { @@ -319,14 +321,18 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant& p_varian } break; case PhysicsServer::BODY_STATE_LINEAR_VELOCITY: { - //if (mode==PhysicsServer::BODY_MODE_STATIC) - // break; + /* + if (mode==PhysicsServer::BODY_MODE_STATIC) + break; + */ linear_velocity=p_variant; wakeup(); } break; case PhysicsServer::BODY_STATE_ANGULAR_VELOCITY: { - //if (mode!=PhysicsServer::BODY_MODE_RIGID) - // break; + /* + if (mode!=PhysicsServer::BODY_MODE_RIGID) + break; + */ angular_velocity=p_variant; wakeup(); @@ -400,11 +406,13 @@ void BodySW::set_space(SpaceSW *p_space){ _update_inertia(); if (active) get_space()->body_add_to_active_list(&active_list); -// _update_queries(); - //if (is_active()) { - // active=false; - // set_active(true); - //} + /* + _update_queries(); + if (is_active()) { + active=false; + set_active(true); + } + */ } @@ -479,13 +487,17 @@ void BodySW::integrate_forces(real_t p_step) { // If less than 0, override dampenings with that of the Body if (angular_damp>=0) area_angular_damp=angular_damp; - //else - // area_angular_damp=damp_area->get_angular_damp(); + /* + else + area_angular_damp=damp_area->get_angular_damp(); + */ if (linear_damp>=0) area_linear_damp=linear_damp; - //else - // area_linear_damp=damp_area->get_linear_damp(); + /* + else + area_linear_damp=damp_area->get_linear_damp(); + */ Vector3 motion; @@ -630,10 +642,10 @@ void BodySW::integrate_velocities(real_t p_step) { _update_transform_dependant(); - //if (fi_callback) { - - // get_space()->body_add_to_state_query_list(&direct_state_query_list); - // + /* + if (fi_callback) { + get_space()->body_add_to_state_query_list(&direct_state_query_list); + */ } /* @@ -772,12 +784,12 @@ BodySW::BodySW() : CollisionObjectSW(TYPE_BODY), active_list(this), inertia_upda active=true; mass=1; -// _inv_inertia=Transform(); + //_inv_inertia=Transform(); _inv_mass=1; bounce=0; friction=1; omit_force_integration=false; -// applied_torque=0; + //applied_torque=0; island_step=0; island_next=NULL; island_list_next=NULL; diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp index 7f8153611f..d02303e23d 100644 --- a/servers/physics/collision_solver_sat.cpp +++ b/servers/physics/collision_solver_sat.cpp @@ -42,9 +42,11 @@ struct _CollectorCallback { _FORCE_INLINE_ void call(const Vector3& p_point_A, const Vector3& p_point_B) { - //if (normal.dot(p_point_A) >= normal.dot(p_point_B)) - // return; -// print_line("** A: "+p_point_A+" B: "+p_point_B+" D: "+rtos(p_point_A.distance_to(p_point_B))); + /* + if (normal.dot(p_point_A) >= normal.dot(p_point_B)) + return; + print_line("** A: "+p_point_A+" B: "+p_point_B+" D: "+rtos(p_point_A.distance_to(p_point_B))); + */ if (swap) callback(p_point_B,p_point_A,userdata); @@ -108,7 +110,7 @@ static void _generate_contacts_edge_edge(const Vector3 * p_points_A,int p_point_ Vector3 c=rel_A.cross(rel_B).cross(rel_B); -// if ( Math::abs(rel_A.dot(c) )<_EDGE_IS_VALID_SUPPORT_TRESHOLD ) { + //if ( Math::abs(rel_A.dot(c) )<_EDGE_IS_VALID_SUPPORT_TRESHOLD ) { if ( Math::abs(rel_A.dot(c) )<CMP_EPSILON ) { // should handle somehow.. @@ -205,7 +207,7 @@ static void _generate_contacts_face_face(const Vector3 * p_points_A,int p_point_ // check for different sides and non coplanar -// if ( (dist0*dist1) < -CMP_EPSILON && !(edge && j)) { + //if ( (dist0*dist1) < -CMP_EPSILON && !(edge && j)) { if ( (dist0*dist1) < 0 && !(edge && j)) { // calculate intersection @@ -233,8 +235,10 @@ static void _generate_contacts_face_face(const Vector3 * p_points_A,int p_point_ for (int i=0;i<clipbuf_len;i++) { float d = plane_B.distance_to(clipbuf_src[i]); - //if (d>CMP_EPSILON) - // continue; + /* + if (d>CMP_EPSILON) + continue; + */ Vector3 closest_B=clipbuf_src[i] - plane_B.normal*d; @@ -1379,7 +1383,7 @@ static void _collision_convex_polygon_convex_polygon(const ShapeSW *p_a,const Tr for (int i=0;i<face_count_A;i++) { Vector3 axis = p_transform_a.xform( faces_A[i].plane ).normal; -// Vector3 axis = p_transform_a.basis.xform( faces_A[i].plane.normal ).normalized(); + //Vector3 axis = p_transform_a.basis.xform( faces_A[i].plane.normal ).normalized(); if (!separator.test_axis( axis )) return; @@ -1389,7 +1393,7 @@ static void _collision_convex_polygon_convex_polygon(const ShapeSW *p_a,const Tr for (int i=0;i<face_count_B;i++) { Vector3 axis = p_transform_b.xform( faces_B[i].plane ).normal; -// Vector3 axis = p_transform_b.basis.xform( faces_B[i].plane.normal ).normalized(); + //Vector3 axis = p_transform_b.basis.xform( faces_B[i].plane.normal ).normalized(); if (!separator.test_axis( axis )) @@ -1502,7 +1506,7 @@ static void _collision_convex_polygon_face(const ShapeSW *p_a,const Transform &p // faces of A for (int i=0;i<face_count;i++) { -// Vector3 axis = p_transform_a.xform( faces[i].plane ).normal; + //Vector3 axis = p_transform_a.xform( faces[i].plane ).normal; Vector3 axis = p_transform_a.basis.xform( faces[i].plane.normal ).normalized(); if (!separator.test_axis( axis )) diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics/collision_solver_sw.cpp index 91ef7913cf..3399849ab7 100644 --- a/servers/physics/collision_solver_sw.cpp +++ b/servers/physics/collision_solver_sw.cpp @@ -383,7 +383,7 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform& concave_B->cull(local_aabb,concave_distance_callback,&cinfo); if (!cinfo.collided) { -// print_line(itos(cinfo.tested)); + //print_line(itos(cinfo.tested)); r_point_A=cinfo.close_A; r_point_B=cinfo.close_B; diff --git a/servers/physics/joints/cone_twist_joint_sw.cpp b/servers/physics/joints/cone_twist_joint_sw.cpp index 5036a1d8a3..cbf444f1e8 100644 --- a/servers/physics/joints/cone_twist_joint_sw.cpp +++ b/servers/physics/joints/cone_twist_joint_sw.cpp @@ -156,7 +156,7 @@ bool ConeTwistJointSW::setup(float p_step) { if (m_swingSpan1 >= real_t(0.05f)) { b1Axis2 = A->get_transform().basis.xform( this->m_rbAFrame.basis.get_axis(1) ); -// swing1 = btAtan2Fast( b2Axis1.dot(b1Axis2),b2Axis1.dot(b1Axis1) ); + //swing1 = btAtan2Fast( b2Axis1.dot(b1Axis2),b2Axis1.dot(b1Axis1) ); swx = b2Axis1.dot(b1Axis1); swy = b2Axis1.dot(b1Axis2); swing1 = atan2fast(swy, swx); @@ -169,7 +169,7 @@ bool ConeTwistJointSW::setup(float p_step) { if (m_swingSpan2 >= real_t(0.05f)) { b1Axis3 = A->get_transform().basis.xform( this->m_rbAFrame.basis.get_axis(2) ); -// swing2 = btAtan2Fast( b2Axis1.dot(b1Axis3),b2Axis1.dot(b1Axis1) ); + //swing2 = btAtan2Fast( b2Axis1.dot(b1Axis3),b2Axis1.dot(b1Axis1) ); swx = b2Axis1.dot(b1Axis1); swy = b2Axis1.dot(b1Axis3); swing2 = atan2fast(swy, swx); diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index 5824de0127..48f70d9077 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -50,10 +50,9 @@ real_t btGetMatrixElem(const Basis& mat, int index) bool matrixToEulerXYZ(const Basis& mat,Vector3& xyz); bool matrixToEulerXYZ(const Basis& mat,Vector3& xyz) { -// // rot = cy*cz -cy*sz sy -// // cz*sx*sy+cx*sz cx*cz-sx*sy*sz -cy*sx -// // -cx*cz*sy+sx*sz cz*sx+cx*sy*sz cx*cy -// + // rot = cy*cz -cy*sz sy + // cz*sx*sy+cx*sz cx*cz-sx*sy*sz -cy*sx + // -cx*cz*sy+sx*sz cz*sx+cx*sy*sz cx*cy if (btGetMatrixElem(mat,2) < real_t(1.0)) { @@ -325,16 +324,18 @@ void Generic6DOFJointSW::calculateAngleInfo() m_calculatedAxis[2] = axis0.cross(m_calculatedAxis[1]); -// if(m_debugDrawer) -// { -// -// char buff[300]; -// sprintf(buff,"\n X: %.2f ; Y: %.2f ; Z: %.2f ", -// m_calculatedAxisAngleDiff[0], -// m_calculatedAxisAngleDiff[1], -// m_calculatedAxisAngleDiff[2]); -// m_debugDrawer->reportErrorWarning(buff); -// } + /* + if(m_debugDrawer) + { + + char buff[300]; + sprintf(buff,"\n X: %.2f ; Y: %.2f ; Z: %.2f ", + m_calculatedAxisAngleDiff[0], + m_calculatedAxisAngleDiff[1], + m_calculatedAxisAngleDiff[2]); + m_debugDrawer->reportErrorWarning(buff); + } + */ } diff --git a/servers/physics/joints/hinge_joint_sw.cpp b/servers/physics/joints/hinge_joint_sw.cpp index 2f07779131..277346fbbb 100644 --- a/servers/physics/joints/hinge_joint_sw.cpp +++ b/servers/physics/joints/hinge_joint_sw.cpp @@ -221,7 +221,7 @@ bool HingeJointSW::setup(float p_step) { // Compute limit information real_t hingeAngle = get_hinge_angle(); -// print_line("angle: "+rtos(hingeAngle)); + //print_line("angle: "+rtos(hingeAngle)); //set bias, sign, clear accumulator m_correction = real_t(0.); m_limitSign = real_t(0.); @@ -235,17 +235,17 @@ bool HingeJointSW::setup(float p_step) { print_line("hi: "+rtos(m_upperLimit)); }*/ -// if (m_lowerLimit < m_upperLimit) + //if (m_lowerLimit < m_upperLimit) if (m_useLimit && m_lowerLimit <= m_upperLimit) { -// if (hingeAngle <= m_lowerLimit*m_limitSoftness) + //if (hingeAngle <= m_lowerLimit*m_limitSoftness) if (hingeAngle <= m_lowerLimit) { m_correction = (m_lowerLimit - hingeAngle); m_limitSign = 1.0f; m_solveLimit = true; } -// else if (hingeAngle >= m_upperLimit*m_limitSoftness) + //else if (hingeAngle >= m_upperLimit*m_limitSoftness) else if (hingeAngle >= m_upperLimit) { m_correction = m_upperLimit - hingeAngle; diff --git a/servers/physics/joints/pin_joint_sw.cpp b/servers/physics/joints/pin_joint_sw.cpp index 292d30443c..9c7fe65684 100644 --- a/servers/physics/joints/pin_joint_sw.cpp +++ b/servers/physics/joints/pin_joint_sw.cpp @@ -68,8 +68,8 @@ void PinJointSW::solve(float p_step){ Vector3 normal(0,0,0); -// Vector3 angvelA = A->get_transform().origin.getBasis().transpose() * A->getAngularVelocity(); -// Vector3 angvelB = B->get_transform().origin.getBasis().transpose() * B->getAngularVelocity(); + //Vector3 angvelA = A->get_transform().origin.getBasis().transpose() * A->getAngularVelocity(); + //Vector3 angvelB = B->get_transform().origin.getBasis().transpose() * B->getAngularVelocity(); for (int i=0;i<3;i++) { diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index 4069ccdccb..b71eae54b0 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -1395,11 +1395,13 @@ void PhysicsServerSW::free(RID p_rid) { BodySW *body = body_owner.get(p_rid); -// if (body->get_state_query()) -// _clear_query(body->get_state_query()); + /* + if (body->get_state_query()) + _clear_query(body->get_state_query()); -// if (body->get_direct_state_query()) -// _clear_query(body->get_direct_state_query()); + if (body->get_direct_state_query()) + _clear_query(body->get_direct_state_query()); + */ body->set_space(NULL); @@ -1422,8 +1424,10 @@ void PhysicsServerSW::free(RID p_rid) { AreaSW *area = area_owner.get(p_rid); -// if (area->get_monitor_query()) -// _clear_query(area->get_monitor_query()); + /* + if (area->get_monitor_query()) + _clear_query(area->get_monitor_query()); + */ area->set_space(NULL); diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index a3f98392fc..72b133c4b9 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -62,7 +62,7 @@ friend class PhysicsDirectSpaceStateSW; mutable RID_Owner<BodySW> body_owner; mutable RID_Owner<JointSW> joint_owner; -// void _clear_query(QuerySW *p_query); + //void _clear_query(QuerySW *p_query); public: struct CollCbkData { diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index 59ade71475..9f8d1107f4 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -1048,8 +1048,10 @@ void ConcavePolygonShapeSW::_cull_segment(int p_idx,_SegmentCullParams *p_params const BVH *bvh=&p_params->bvh[p_idx]; - //if (p_params->dir.dot(bvh->aabb.get_support(-p_params->dir))>p_params->min_d) - // return; //test against whole AABB, which isn't very costly + /* + if (p_params->dir.dot(bvh->aabb.get_support(-p_params->dir))>p_params->min_d) + return; //test against whole AABB, which isn't very costly + */ //printf("addr: %p\n",bvh); @@ -1309,7 +1311,7 @@ _VolumeSW_BVH* _volume_sw_build_bvh(_VolumeSW_BVH_Element *p_elements,int p_size bvh->left=_volume_sw_build_bvh(p_elements,split,count); bvh->right=_volume_sw_build_bvh(&p_elements[split],p_size-split,count); -// printf("branch at %p - %i: %i\n",bvh,count,bvh->face_index); + //printf("branch at %p - %i: %i\n",bvh,count,bvh->face_index); count++; return bvh; } @@ -1322,7 +1324,7 @@ void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH* p_bvh_tree,BVH* p_bvh_array p_bvh_array[idx].aabb=p_bvh_tree->aabb; p_bvh_array[idx].face_index=p_bvh_tree->face_index; -// printf("%p - %i: %i(%p) -- %p:%p\n",%p_bvh_array[idx],p_idx,p_bvh_array[i]->face_index,&p_bvh_tree->face_index,p_bvh_tree->left,p_bvh_tree->right); + //printf("%p - %i: %i(%p) -- %p:%p\n",%p_bvh_array[idx],p_idx,p_bvh_array[i]->face_index,&p_bvh_tree->face_index,p_bvh_tree->left,p_bvh_tree->right); if (p_bvh_tree->left) { diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h index 3cbd1c9609..919c681105 100644 --- a/servers/physics/shape_sw.h +++ b/servers/physics/shape_sw.h @@ -366,8 +366,8 @@ struct HeightMapShapeSW : public ConcaveShapeSW { int depth; float cell_size; -// void _cull_segment(int p_idx,_SegmentCullParams *p_params) const; -// void _cull(int p_idx,_CullParams *p_params) const; + //void _cull_segment(int p_idx,_SegmentCullParams *p_params) const; + //void _cull(int p_idx,_CullParams *p_params) const; void _setup(PoolVector<float> p_heights,int p_width,int p_depth,float p_cell_size); public: diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index d73d5f140e..eaa3d3194c 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -204,8 +204,10 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID& p_shape, const Transform& aabb=aabb.merge(Rect3(aabb.pos+p_motion,aabb.size)); //motion aabb=aabb.grow(p_margin); - //if (p_motion!=Vector3()) - // print_line(p_motion); + /* + if (p_motion!=Vector3()) + print_line(p_motion); + */ int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,SpaceSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results); diff --git a/servers/physics/step_sw.cpp b/servers/physics/step_sw.cpp index e24081761b..30ee33a7de 100644 --- a/servers/physics/step_sw.cpp +++ b/servers/physics/step_sw.cpp @@ -233,7 +233,7 @@ void StepSW::step(SpaceSW* p_space,float p_delta,int p_iterations) { } -// print_line("island count: "+itos(island_count)+" active count: "+itos(active_count)); + //print_line("island count: "+itos(island_count)+" active count: "+itos(active_count)); /* SETUP CONSTRAINT ISLANDS */ { |