summaryrefslogtreecommitdiff
path: root/servers/physics
diff options
context:
space:
mode:
Diffstat (limited to 'servers/physics')
-rw-r--r--servers/physics/body_sw.cpp18
-rw-r--r--servers/physics/body_sw.h14
-rw-r--r--servers/physics/broad_phase_basic.cpp8
-rw-r--r--servers/physics/broad_phase_basic.h6
-rw-r--r--servers/physics/broad_phase_octree.cpp6
-rw-r--r--servers/physics/broad_phase_octree.h4
-rw-r--r--servers/physics/broad_phase_sw.h4
-rw-r--r--servers/physics/collision_object_sw.cpp6
-rw-r--r--servers/physics/collision_object_sw.h4
-rw-r--r--servers/physics/collision_solver_sw.cpp10
-rw-r--r--servers/physics/collision_solver_sw.h2
-rw-r--r--servers/physics/joints/generic_6dof_joint_sw.cpp10
-rw-r--r--servers/physics/joints/hinge_joint_sw.cpp4
-rw-r--r--servers/physics/joints/jacobian_entry_sw.h10
-rw-r--r--servers/physics/shape_sw.cpp36
-rw-r--r--servers/physics/shape_sw.h18
-rw-r--r--servers/physics/space_sw.cpp10
17 files changed, 85 insertions, 85 deletions
diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp
index 2f859a4ed4..ceeeafe04a 100644
--- a/servers/physics/body_sw.cpp
+++ b/servers/physics/body_sw.cpp
@@ -43,8 +43,8 @@ void BodySW::_update_transform_dependant() {
principal_inertia_axes = get_transform().basis * principal_inertia_axes_local;
// update inertia tensor
- Matrix3 tb = principal_inertia_axes;
- Matrix3 tbt = tb.transposed();
+ Basis tb = principal_inertia_axes;
+ Basis tbt = tb.transposed();
tb.scale(_inv_inertia);
_inv_inertia_tensor = tb * tbt;
@@ -81,7 +81,7 @@ void BodySW::update_inertias() {
center_of_mass_local /= mass;
// Recompute the inertia tensor
- Matrix3 inertia_tensor;
+ Basis inertia_tensor;
inertia_tensor.set_zero();
for (int i=0;i<get_shape_count();i++) {
@@ -92,15 +92,15 @@ void BodySW::update_inertias() {
float mass = area * this->mass / total_area;
- Matrix3 shape_inertia_tensor=shape->get_moment_of_inertia(mass).to_diagonal_matrix();
+ Basis shape_inertia_tensor=shape->get_moment_of_inertia(mass).to_diagonal_matrix();
Transform shape_transform=get_shape_transform(i);
- Matrix3 shape_basis = shape_transform.basis.orthonormalized();
+ Basis shape_basis = shape_transform.basis.orthonormalized();
// NOTE: we don't take the scale of collision shapes into account when computing the inertia tensor!
shape_inertia_tensor = shape_basis * shape_inertia_tensor * shape_basis.transposed();
Vector3 shape_origin = shape_transform.origin - center_of_mass_local;
- inertia_tensor += shape_inertia_tensor + (Matrix3()*shape_origin.dot(shape_origin)-shape_origin.outer(shape_origin))*mass;
+ inertia_tensor += shape_inertia_tensor + (Basis()*shape_origin.dot(shape_origin)-shape_origin.outer(shape_origin))*mass;
}
@@ -497,7 +497,7 @@ void BodySW::integrate_forces(real_t p_step) {
linear_velocity = (new_transform.origin - get_transform().origin)/p_step;
//compute a FAKE angular velocity, not so easy
- Matrix3 rot=new_transform.basis.orthonormalized().transposed() * get_transform().basis.orthonormalized();
+ Basis rot=new_transform.basis.orthonormalized().transposed() * get_transform().basis.orthonormalized();
Vector3 axis;
float angle;
@@ -609,8 +609,8 @@ void BodySW::integrate_velocities(real_t p_step) {
if (ang_vel!=0.0) {
Vector3 ang_vel_axis = total_angular_velocity / ang_vel;
- Matrix3 rot( ang_vel_axis, -ang_vel*p_step );
- Matrix3 identity3(1, 0, 0, 0, 1, 0, 0, 0, 1);
+ Basis rot( ang_vel_axis, -ang_vel*p_step );
+ Basis identity3(1, 0, 0, 0, 1, 0, 0, 0, 1);
transform.origin += ((identity3 - rot) * transform.basis).xform(center_of_mass_local);
transform.basis = rot * transform.basis;
transform.orthonormalize();
diff --git a/servers/physics/body_sw.h b/servers/physics/body_sw.h
index acdd84d259..e6ed3e75e5 100644
--- a/servers/physics/body_sw.h
+++ b/servers/physics/body_sw.h
@@ -60,12 +60,12 @@ class BodySW : public CollisionObjectSW {
Vector3 _inv_inertia; // Relative to the principal axes of inertia
// Relative to the local frame of reference
- Matrix3 principal_inertia_axes_local;
+ Basis principal_inertia_axes_local;
Vector3 center_of_mass_local;
// In world orientation with local origin
- Matrix3 _inv_inertia_tensor;
- Matrix3 principal_inertia_axes;
+ Basis _inv_inertia_tensor;
+ Basis principal_inertia_axes;
Vector3 center_of_mass;
Vector3 gravity;
@@ -198,7 +198,7 @@ public:
_FORCE_INLINE_ void set_omit_force_integration(bool p_omit_force_integration) { omit_force_integration=p_omit_force_integration; }
_FORCE_INLINE_ bool get_omit_force_integration() const { return omit_force_integration; }
- _FORCE_INLINE_ Matrix3 get_principal_inertia_axes() const { return principal_inertia_axes; }
+ _FORCE_INLINE_ Basis get_principal_inertia_axes() const { return principal_inertia_axes; }
_FORCE_INLINE_ Vector3 get_center_of_mass() const { return center_of_mass; }
_FORCE_INLINE_ Vector3 xform_local_to_principal(const Vector3& p_pos) const { return principal_inertia_axes_local.xform(p_pos - center_of_mass_local); }
@@ -272,7 +272,7 @@ public:
_FORCE_INLINE_ real_t get_inv_mass() const { return _inv_mass; }
_FORCE_INLINE_ Vector3 get_inv_inertia() const { return _inv_inertia; }
- _FORCE_INLINE_ Matrix3 get_inv_inertia_tensor() const { return _inv_inertia_tensor; }
+ _FORCE_INLINE_ Basis get_inv_inertia_tensor() const { return _inv_inertia_tensor; }
_FORCE_INLINE_ real_t get_friction() const { return friction; }
_FORCE_INLINE_ Vector3 get_gravity() const { return gravity; }
_FORCE_INLINE_ real_t get_bounce() const { return bounce; }
@@ -381,11 +381,11 @@ public:
virtual float get_total_linear_damp() const { return body->area_linear_damp; } // get density of this body space/area
virtual Vector3 get_center_of_mass() const { return body->get_center_of_mass(); }
- virtual Matrix3 get_principal_inertia_axes() const { return body->get_principal_inertia_axes(); }
+ virtual Basis get_principal_inertia_axes() const { return body->get_principal_inertia_axes(); }
virtual float get_inverse_mass() const { return body->get_inv_mass(); } // get the mass
virtual Vector3 get_inverse_inertia() const { return body->get_inv_inertia(); } // get density of this body space
- virtual Matrix3 get_inverse_inertia_tensor() const { return body->get_inv_inertia_tensor(); } // get density of this body space
+ virtual Basis get_inverse_inertia_tensor() const { return body->get_inv_inertia_tensor(); } // get density of this body space
virtual void set_linear_velocity(const Vector3& p_velocity) { body->set_linear_velocity(p_velocity); }
virtual Vector3 get_linear_velocity() const { return body->get_linear_velocity(); }
diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics/broad_phase_basic.cpp
index 30b5978594..f1c22caae3 100644
--- a/servers/physics/broad_phase_basic.cpp
+++ b/servers/physics/broad_phase_basic.cpp
@@ -47,7 +47,7 @@ BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object_, int p_sub
return current;
}
-void BroadPhaseBasic::move(ID p_id, const AABB& p_aabb) {
+void BroadPhaseBasic::move(ID p_id, const Rect3& p_aabb) {
Map<ID,Element>::Element *E=element_map.find(p_id);
ERR_FAIL_COND(!E);
@@ -115,7 +115,7 @@ int BroadPhaseBasic::cull_segment(const Vector3& p_from, const Vector3& p_to,Col
for (Map<ID,Element>::Element *E=element_map.front();E;E=E->next()) {
- const AABB aabb=E->get().aabb;
+ const Rect3 aabb=E->get().aabb;
if (aabb.intersects_segment(p_from,p_to)) {
p_results[rc]=E->get().owner;
@@ -129,13 +129,13 @@ int BroadPhaseBasic::cull_segment(const Vector3& p_from, const Vector3& p_to,Col
return rc;
}
-int BroadPhaseBasic::cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices) {
+int BroadPhaseBasic::cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices) {
int rc=0;
for (Map<ID,Element>::Element *E=element_map.front();E;E=E->next()) {
- const AABB aabb=E->get().aabb;
+ const Rect3 aabb=E->get().aabb;
if (aabb.intersects(p_aabb)) {
p_results[rc]=E->get().owner;
diff --git a/servers/physics/broad_phase_basic.h b/servers/physics/broad_phase_basic.h
index 423ff0a6a8..9f07e896c4 100644
--- a/servers/physics/broad_phase_basic.h
+++ b/servers/physics/broad_phase_basic.h
@@ -38,7 +38,7 @@ class BroadPhaseBasic : public BroadPhaseSW {
CollisionObjectSW *owner;
bool _static;
- AABB aabb;
+ Rect3 aabb;
int subindex;
};
@@ -78,7 +78,7 @@ public:
// 0 is an invalid ID
virtual ID create(CollisionObjectSW *p_object_, int p_subindex=0);
- virtual void move(ID p_id, const AABB& p_aabb);
+ virtual void move(ID p_id, const Rect3& p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
@@ -87,7 +87,7 @@ public:
virtual int get_subindex(ID p_id) const;
virtual int cull_segment(const Vector3& p_from, const Vector3& p_to,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL);
- virtual int cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL);
+ virtual int cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL);
virtual void set_pair_callback(PairCallback p_pair_callback,void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback,void *p_userdata);
diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics/broad_phase_octree.cpp
index 60fbf926bd..89581997a2 100644
--- a/servers/physics/broad_phase_octree.cpp
+++ b/servers/physics/broad_phase_octree.cpp
@@ -31,11 +31,11 @@
BroadPhaseSW::ID BroadPhaseOctree::create(CollisionObjectSW *p_object, int p_subindex) {
- ID oid = octree.create(p_object,AABB(),p_subindex,false,1<<p_object->get_type(),0);
+ ID oid = octree.create(p_object,Rect3(),p_subindex,false,1<<p_object->get_type(),0);
return oid;
}
-void BroadPhaseOctree::move(ID p_id, const AABB& p_aabb){
+void BroadPhaseOctree::move(ID p_id, const Rect3& p_aabb){
octree.move(p_id,p_aabb);
}
@@ -71,7 +71,7 @@ int BroadPhaseOctree::cull_segment(const Vector3& p_from, const Vector3& p_to,Co
return octree.cull_segment(p_from,p_to,p_results,p_max_results,p_result_indices);
}
-int BroadPhaseOctree::cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices) {
+int BroadPhaseOctree::cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices) {
return octree.cull_AABB(p_aabb,p_results,p_max_results,p_result_indices);
diff --git a/servers/physics/broad_phase_octree.h b/servers/physics/broad_phase_octree.h
index 43005812e7..29f1123edf 100644
--- a/servers/physics/broad_phase_octree.h
+++ b/servers/physics/broad_phase_octree.h
@@ -50,7 +50,7 @@ public:
// 0 is an invalid ID
virtual ID create(CollisionObjectSW *p_object_, int p_subindex=0);
- virtual void move(ID p_id, const AABB& p_aabb);
+ virtual void move(ID p_id, const Rect3& p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
@@ -59,7 +59,7 @@ public:
virtual int get_subindex(ID p_id) const;
virtual int cull_segment(const Vector3& p_from, const Vector3& p_to,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL);
- virtual int cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL);
+ virtual int cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL);
virtual void set_pair_callback(PairCallback p_pair_callback,void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback,void *p_userdata);
diff --git a/servers/physics/broad_phase_sw.h b/servers/physics/broad_phase_sw.h
index 736b674185..2cc2d7d45e 100644
--- a/servers/physics/broad_phase_sw.h
+++ b/servers/physics/broad_phase_sw.h
@@ -50,7 +50,7 @@ public:
// 0 is an invalid ID
virtual ID create(CollisionObjectSW *p_object_, int p_subindex=0)=0;
- virtual void move(ID p_id, const AABB& p_aabb)=0;
+ virtual void move(ID p_id, const Rect3& p_aabb)=0;
virtual void set_static(ID p_id, bool p_static)=0;
virtual void remove(ID p_id)=0;
@@ -59,7 +59,7 @@ public:
virtual int get_subindex(ID p_id) const=0;
virtual int cull_segment(const Vector3& p_from, const Vector3& p_to,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL)=0;
- virtual int cull_aabb(const AABB& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL)=0;
+ virtual int cull_aabb(const Rect3& p_aabb,CollisionObjectSW** p_results,int p_max_results,int *p_result_indices=NULL)=0;
virtual void set_pair_callback(PairCallback p_pair_callback,void *p_userdata)=0;
virtual void set_unpair_callback(UnpairCallback p_unpair_callback,void *p_userdata)=0;
diff --git a/servers/physics/collision_object_sw.cpp b/servers/physics/collision_object_sw.cpp
index 2b2b73738a..88aa737579 100644
--- a/servers/physics/collision_object_sw.cpp
+++ b/servers/physics/collision_object_sw.cpp
@@ -138,7 +138,7 @@ void CollisionObjectSW::_update_shapes() {
}
//not quite correct, should compute the next matrix..
- AABB shape_aabb=s.shape->get_aabb();
+ Rect3 shape_aabb=s.shape->get_aabb();
Transform xform = transform * s.xform;
shape_aabb=xform.xform(shape_aabb);
s.aabb_cache=shape_aabb;
@@ -167,10 +167,10 @@ void CollisionObjectSW::_update_shapes_with_motion(const Vector3& p_motion) {
}
//not quite correct, should compute the next matrix..
- AABB shape_aabb=s.shape->get_aabb();
+ Rect3 shape_aabb=s.shape->get_aabb();
Transform xform = transform * s.xform;
shape_aabb=xform.xform(shape_aabb);
- shape_aabb=shape_aabb.merge(AABB( shape_aabb.pos+p_motion,shape_aabb.size)); //use motion
+ shape_aabb=shape_aabb.merge(Rect3( shape_aabb.pos+p_motion,shape_aabb.size)); //use motion
s.aabb_cache=shape_aabb;
space->get_broadphase()->move(s.bpid,shape_aabb);
diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h
index f3e43c98db..c46a7f4a5f 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics/collision_object_sw.h
@@ -60,7 +60,7 @@ private:
Transform xform;
Transform xform_inv;
BroadPhaseSW::ID bpid;
- AABB aabb_cache; //for rayqueries
+ Rect3 aabb_cache; //for rayqueries
real_t area_cache;
ShapeSW *shape;
bool trigger;
@@ -123,7 +123,7 @@ public:
_FORCE_INLINE_ ShapeSW *get_shape(int p_index) const { return shapes[p_index].shape; }
_FORCE_INLINE_ const Transform& get_shape_transform(int p_index) const { return shapes[p_index].xform; }
_FORCE_INLINE_ const Transform& get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; }
- _FORCE_INLINE_ const AABB& get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; }
+ _FORCE_INLINE_ const Rect3& get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; }
_FORCE_INLINE_ const real_t get_shape_area(int p_index) const { return shapes[p_index].area_cache; }
_FORCE_INLINE_ Transform get_transform() const { return transform; }
diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics/collision_solver_sw.cpp
index 886d93c4b4..91ef7913cf 100644
--- a/servers/physics/collision_solver_sw.cpp
+++ b/servers/physics/collision_solver_sw.cpp
@@ -160,7 +160,7 @@ bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A,const Transform&
//quickly compute a local AABB
- AABB local_aabb;
+ Rect3 local_aabb;
for(int i=0;i<3;i++) {
Vector3 axis( p_transform_B.basis.get_axis(i) );
@@ -313,7 +313,7 @@ bool CollisionSolverSW::solve_distance_plane(const ShapeSW *p_shape_A,const Tran
return collided;
}
-bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const AABB& p_concave_hint,Vector3 *r_sep_axis) {
+bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const Rect3& p_concave_hint,Vector3 *r_sep_axis) {
if (p_shape_A->is_concave())
return false;
@@ -351,14 +351,14 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform&
//quickly compute a local AABB
- bool use_cc_hint=p_concave_hint!=AABB();
- AABB cc_hint_aabb;
+ bool use_cc_hint=p_concave_hint!=Rect3();
+ Rect3 cc_hint_aabb;
if (use_cc_hint) {
cc_hint_aabb=p_concave_hint;
cc_hint_aabb.pos-=p_transform_B.origin;
}
- AABB local_aabb;
+ Rect3 local_aabb;
for(int i=0;i<3;i++) {
Vector3 axis( p_transform_B.basis.get_axis(i) );
diff --git a/servers/physics/collision_solver_sw.h b/servers/physics/collision_solver_sw.h
index 82ac77f73d..16d2b92d70 100644
--- a/servers/physics/collision_solver_sw.h
+++ b/servers/physics/collision_solver_sw.h
@@ -48,7 +48,7 @@ public:
static bool solve_static(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,CallbackResult p_result_callback,void *p_userdata,Vector3 *r_sep_axis=NULL,float p_margin_A=0,float p_margin_B=0);
- static bool solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const AABB& p_concave_hint,Vector3 *r_sep_axis=NULL);
+ static bool solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const Rect3& p_concave_hint,Vector3 *r_sep_axis=NULL);
};
diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp
index 3c0119971a..5824de0127 100644
--- a/servers/physics/joints/generic_6dof_joint_sw.cpp
+++ b/servers/physics/joints/generic_6dof_joint_sw.cpp
@@ -38,8 +38,8 @@ See corresponding header file for licensing info.
#define GENERIC_D6_DISABLE_WARMSTARTING 1
-real_t btGetMatrixElem(const Matrix3& mat, int index);
-real_t btGetMatrixElem(const Matrix3& mat, int index)
+real_t btGetMatrixElem(const Basis& mat, int index);
+real_t btGetMatrixElem(const Basis& mat, int index)
{
int i = index%3;
int j = index/3;
@@ -47,8 +47,8 @@ real_t btGetMatrixElem(const Matrix3& mat, int index)
}
///MatrixToEulerXYZ from http://www.geometrictools.com/LibFoundation/Mathematics/Wm4Matrix3.inl.html
-bool matrixToEulerXYZ(const Matrix3& mat,Vector3& xyz);
-bool matrixToEulerXYZ(const Matrix3& mat,Vector3& xyz)
+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
@@ -296,7 +296,7 @@ Generic6DOFJointSW::Generic6DOFJointSW(BodySW* rbA, BodySW* rbB, const Transform
void Generic6DOFJointSW::calculateAngleInfo()
{
- Matrix3 relative_frame = m_calculatedTransformA.basis.inverse()*m_calculatedTransformB.basis;
+ Basis relative_frame = m_calculatedTransformA.basis.inverse()*m_calculatedTransformB.basis;
matrixToEulerXYZ(relative_frame,m_calculatedAxisAngleDiff);
diff --git a/servers/physics/joints/hinge_joint_sw.cpp b/servers/physics/joints/hinge_joint_sw.cpp
index 23e00a9e7f..2f07779131 100644
--- a/servers/physics/joints/hinge_joint_sw.cpp
+++ b/servers/physics/joints/hinge_joint_sw.cpp
@@ -112,7 +112,7 @@ HingeJointSW::HingeJointSW(BodySW* rbA,BodySW* rbB, const Vector3& pivotInA,cons
rbAxisA1 = rbAxisA2.cross(axisInA);
}
- m_rbAFrame.basis=Matrix3( rbAxisA1.x,rbAxisA2.x,axisInA.x,
+ m_rbAFrame.basis=Basis( rbAxisA1.x,rbAxisA2.x,axisInA.x,
rbAxisA1.y,rbAxisA2.y,axisInA.y,
rbAxisA1.z,rbAxisA2.z,axisInA.z );
@@ -121,7 +121,7 @@ HingeJointSW::HingeJointSW(BodySW* rbA,BodySW* rbB, const Vector3& pivotInA,cons
Vector3 rbAxisB2 = axisInB.cross(rbAxisB1);
m_rbBFrame.origin = pivotInB;
- m_rbBFrame.basis=Matrix3( rbAxisB1.x,rbAxisB2.x,-axisInB.x,
+ m_rbBFrame.basis=Basis( rbAxisB1.x,rbAxisB2.x,-axisInB.x,
rbAxisB1.y,rbAxisB2.y,-axisInB.y,
rbAxisB1.z,rbAxisB2.z,-axisInB.z );
diff --git a/servers/physics/joints/jacobian_entry_sw.h b/servers/physics/joints/jacobian_entry_sw.h
index 1a54859956..cd85162ba5 100644
--- a/servers/physics/joints/jacobian_entry_sw.h
+++ b/servers/physics/joints/jacobian_entry_sw.h
@@ -56,8 +56,8 @@ public:
JacobianEntrySW() {};
//constraint between two different rigidbodies
JacobianEntrySW(
- const Matrix3& world2A,
- const Matrix3& world2B,
+ const Basis& world2A,
+ const Basis& world2B,
const Vector3& rel_pos1,const Vector3& rel_pos2,
const Vector3& jointAxis,
const Vector3& inertiaInvA,
@@ -77,8 +77,8 @@ public:
//angular constraint between two different rigidbodies
JacobianEntrySW(const Vector3& jointAxis,
- const Matrix3& world2A,
- const Matrix3& world2B,
+ const Basis& world2A,
+ const Basis& world2B,
const Vector3& inertiaInvA,
const Vector3& inertiaInvB)
:m_linearJointAxis(Vector3(real_t(0.),real_t(0.),real_t(0.)))
@@ -110,7 +110,7 @@ public:
//constraint on one rigidbody
JacobianEntrySW(
- const Matrix3& world2A,
+ const Basis& world2A,
const Vector3& rel_pos1,const Vector3& rel_pos2,
const Vector3& jointAxis,
const Vector3& inertiaInvA,
diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp
index c853dcff35..59ade71475 100644
--- a/servers/physics/shape_sw.cpp
+++ b/servers/physics/shape_sw.cpp
@@ -35,7 +35,7 @@
#define _FACE_IS_VALID_SUPPORT_TRESHOLD 0.9998
-void ShapeSW::configure(const AABB& p_aabb) {
+void ShapeSW::configure(const Rect3& p_aabb) {
aabb=p_aabb;
configured=true;
for (Map<ShapeOwnerSW*,int>::Element *E=owners.front();E;E=E->next()) {
@@ -133,7 +133,7 @@ Vector3 PlaneShapeSW::get_moment_of_inertia(float p_mass) const {
void PlaneShapeSW::_setup(const Plane& p_plane) {
plane=p_plane;
- configure(AABB(Vector3(-1e4,-1e4,-1e4),Vector3(1e4*2,1e4*2,1e4*2)));
+ configure(Rect3(Vector3(-1e4,-1e4,-1e4),Vector3(1e4*2,1e4*2,1e4*2)));
}
void PlaneShapeSW::set_data(const Variant& p_data) {
@@ -204,7 +204,7 @@ Vector3 RayShapeSW::get_moment_of_inertia(float p_mass) const {
void RayShapeSW::_setup(float p_length) {
length=p_length;
- configure(AABB(Vector3(0,0,0),Vector3(0.1,0.1,length)));
+ configure(Rect3(Vector3(0,0,0),Vector3(0.1,0.1,length)));
}
void RayShapeSW::set_data(const Variant& p_data) {
@@ -271,7 +271,7 @@ void SphereShapeSW::_setup(real_t p_radius) {
radius=p_radius;
- configure(AABB( Vector3(-radius,-radius,-radius), Vector3(radius*2.0,radius*2.0,radius*2.0)));
+ configure(Rect3( Vector3(-radius,-radius,-radius), Vector3(radius*2.0,radius*2.0,radius*2.0)));
}
@@ -412,7 +412,7 @@ void BoxShapeSW::get_supports(const Vector3& p_normal,int p_max,Vector3 *r_suppo
bool BoxShapeSW::intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_result, Vector3 &r_normal) const {
- AABB aabb(-half_extents,half_extents*2.0);
+ Rect3 aabb(-half_extents,half_extents*2.0);
return aabb.intersects_segment(p_begin,p_end,&r_result,&r_normal);
@@ -432,7 +432,7 @@ void BoxShapeSW::_setup(const Vector3& p_half_extents) {
half_extents=p_half_extents.abs();
- configure(AABB(-half_extents,half_extents*2));
+ configure(Rect3(-half_extents,half_extents*2));
}
@@ -604,7 +604,7 @@ void CapsuleShapeSW::_setup(real_t p_height,real_t p_radius) {
height=p_height;
radius=p_radius;
- configure(AABB(Vector3(-radius,-radius,-height*0.5-radius),Vector3(radius*2,radius*2,height+radius*2.0)));
+ configure(Rect3(Vector3(-radius,-radius,-height*0.5-radius),Vector3(radius*2,radius*2,height+radius*2.0)));
}
@@ -818,7 +818,7 @@ Vector3 ConvexPolygonShapeSW::get_moment_of_inertia(float p_mass) const {
void ConvexPolygonShapeSW::_setup(const Vector<Vector3>& p_vertices) {
Error err = QuickHull::build(p_vertices,mesh);
- AABB _aabb;
+ Rect3 _aabb;
for(int i=0;i<mesh.vertices.size();i++) {
@@ -965,7 +965,7 @@ Vector3 FaceShapeSW::get_moment_of_inertia(float p_mass) const {
FaceShapeSW::FaceShapeSW() {
- configure(AABB());
+ configure(Rect3());
}
@@ -1175,13 +1175,13 @@ void ConcavePolygonShapeSW::_cull(int p_idx,_CullParams *p_params) const {
}
}
-void ConcavePolygonShapeSW::cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const {
+void ConcavePolygonShapeSW::cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const {
// make matrix local to concave
if (faces.size()==0)
return;
- AABB local_aabb=p_local_aabb;
+ Rect3 local_aabb=p_local_aabb;
// unlock data
PoolVector<Face>::Read fr=faces.read();
@@ -1219,7 +1219,7 @@ Vector3 ConcavePolygonShapeSW::get_moment_of_inertia(float p_mass) const {
struct _VolumeSW_BVH_Element {
- AABB aabb;
+ Rect3 aabb;
Vector3 center;
int face_index;
};
@@ -1251,7 +1251,7 @@ struct _VolumeSW_BVH_CompareZ {
struct _VolumeSW_BVH {
- AABB aabb;
+ Rect3 aabb;
_VolumeSW_BVH *left;
_VolumeSW_BVH *right;
@@ -1276,7 +1276,7 @@ _VolumeSW_BVH* _volume_sw_build_bvh(_VolumeSW_BVH_Element *p_elements,int p_size
bvh->face_index=-1;
}
- AABB aabb;
+ Rect3 aabb;
for(int i=0;i<p_size;i++) {
if (i==0)
@@ -1351,7 +1351,7 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) {
int src_face_count=p_faces.size();
if (src_face_count==0) {
- configure(AABB());
+ configure(Rect3());
return;
}
ERR_FAIL_COND(src_face_count%3);
@@ -1488,7 +1488,7 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) {
PoolVector<Vector3>::Write vw = vertices.write();
Vector3 *verticesw=vw.ptr();
- AABB _aabb;
+ Rect3 _aabb;
for(int i=0;i<src_face_count;i++) {
@@ -1593,7 +1593,7 @@ bool HeightMapShapeSW::intersect_segment(const Vector3& p_begin,const Vector3& p
}
-void HeightMapShapeSW::cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const {
+void HeightMapShapeSW::cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const {
@@ -1623,7 +1623,7 @@ void HeightMapShapeSW::_setup(PoolVector<real_t> p_heights,int p_width,int p_dep
PoolVector<real_t>::Read r = heights. read();
- AABB aabb;
+ Rect3 aabb;
for(int i=0;i<depth;i++) {
diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h
index 2298be7530..3cbd1c9609 100644
--- a/servers/physics/shape_sw.h
+++ b/servers/physics/shape_sw.h
@@ -59,14 +59,14 @@ public:
class ShapeSW : public RID_Data {
RID self;
- AABB aabb;
+ Rect3 aabb;
bool configured;
real_t custom_bias;
Map<ShapeOwnerSW*,int> owners;
protected:
- void configure(const AABB& p_aabb);
+ void configure(const Rect3& p_aabb);
public:
enum {
@@ -80,7 +80,7 @@ public:
virtual PhysicsServer::ShapeType get_type() const=0;
- _FORCE_INLINE_ AABB get_aabb() const { return aabb; }
+ _FORCE_INLINE_ Rect3 get_aabb() const { return aabb; }
_FORCE_INLINE_ bool is_configured() const { return configured; }
virtual bool is_concave() const { return false; }
@@ -116,7 +116,7 @@ public:
typedef void (*Callback)(void* p_userdata,ShapeSW *p_convex);
virtual void get_supports(const Vector3& p_normal,int p_max,Vector3 *r_supports,int & r_amount) const { r_amount=0; }
- virtual void cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const=0;
+ virtual void cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const=0;
ConcaveShapeSW() {}
};
@@ -293,7 +293,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW {
struct BVH {
- AABB aabb;
+ Rect3 aabb;
int left;
int right;
@@ -304,7 +304,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW {
struct _CullParams {
- AABB aabb;
+ Rect3 aabb;
Callback callback;
void *userdata;
const Face *faces;
@@ -347,7 +347,7 @@ public:
virtual bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_result, Vector3 &r_normal) const;
- virtual void cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const;
+ virtual void cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const;
virtual Vector3 get_moment_of_inertia(float p_mass) const;
@@ -383,7 +383,7 @@ public:
virtual Vector3 get_support(const Vector3& p_normal) const;
virtual bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_result, Vector3 &r_normal) const;
- virtual void cull(const AABB& p_local_aabb,Callback p_callback,void* p_userdata) const;
+ virtual void cull(const Rect3& p_local_aabb,Callback p_callback,void* p_userdata) const;
virtual Vector3 get_moment_of_inertia(float p_mass) const;
@@ -455,7 +455,7 @@ struct MotionShapeSW : public ShapeSW {
virtual void set_data(const Variant& p_data) {}
virtual Variant get_data() const { return Variant(); }
- MotionShapeSW() { configure(AABB()); }
+ MotionShapeSW() { configure(Rect3()); }
};
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index 596c7af214..d73d5f140e 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -146,7 +146,7 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID& p_shape, const Transfo
ShapeSW *shape = static_cast<PhysicsServerSW*>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape,0);
- AABB aabb = p_xform.xform(shape->get_aabb());
+ Rect3 aabb = p_xform.xform(shape->get_aabb());
int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,SpaceSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results);
@@ -200,8 +200,8 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID& p_shape, const Transform&
ShapeSW *shape = static_cast<PhysicsServerSW*>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape,false);
- AABB aabb = p_xform.xform(shape->get_aabb());
- aabb=aabb.merge(AABB(aabb.pos+p_motion,aabb.size)); //motion
+ Rect3 aabb = p_xform.xform(shape->get_aabb());
+ aabb=aabb.merge(Rect3(aabb.pos+p_motion,aabb.size)); //motion
aabb=aabb.grow(p_margin);
//if (p_motion!=Vector3())
@@ -329,7 +329,7 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform& p_sh
ShapeSW *shape = static_cast<PhysicsServerSW*>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape,0);
- AABB aabb = p_shape_xform.xform(shape->get_aabb());
+ Rect3 aabb = p_shape_xform.xform(shape->get_aabb());
aabb=aabb.grow(p_margin);
int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,SpaceSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results);
@@ -412,7 +412,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform& p_shape_
ShapeSW *shape = static_cast<PhysicsServerSW*>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape,0);
- AABB aabb = p_shape_xform.xform(shape->get_aabb());
+ Rect3 aabb = p_shape_xform.xform(shape->get_aabb());
aabb=aabb.grow(p_margin);
int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,SpaceSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results);