diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-15 09:49:58 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-15 09:50:27 -0300 |
commit | 52e2a1e98df9f1a7d69c2b35c7be9edc1a8e9753 (patch) | |
tree | e2aabb4d21d102ad4f6da8b47e08ea3edcdb782b /servers/physics_2d | |
parent | a7854d3ae6a81093b1cf23da3dd99b57b1aebc34 (diff) |
fixed to 2D physics, makes it work again
Diffstat (limited to 'servers/physics_2d')
-rw-r--r-- | servers/physics_2d/body_pair_2d_sw.cpp | 2 | ||||
-rw-r--r-- | servers/physics_2d/collision_solver_2d_sw.cpp | 4 | ||||
-rw-r--r-- | servers/physics_2d/shape_2d_sw.h | 2 | ||||
-rw-r--r-- | servers/physics_2d/space_2d_sw.cpp | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp index 72ae221c39..e6b62ffa66 100644 --- a/servers/physics_2d/body_pair_2d_sw.cpp +++ b/servers/physics_2d/body_pair_2d_sw.cpp @@ -249,7 +249,7 @@ bool BodyPair2DSW::setup(float p_step) { Transform2D xform_A = xform_Au * A->get_shape_transform(shape_A); Transform2D xform_Bu = B->get_transform(); - xform_Bu.translate(-A->get_transform().get_origin()); + xform_Bu.elements[2]-=A->get_transform().get_origin(); Transform2D xform_B = xform_Bu * B->get_shape_transform(shape_B); Shape2DSW *shape_A_ptr=A->get_shape(shape_A); diff --git a/servers/physics_2d/collision_solver_2d_sw.cpp b/servers/physics_2d/collision_solver_2d_sw.cpp index 02d59b69f0..20a5934eb8 100644 --- a/servers/physics_2d/collision_solver_2d_sw.cpp +++ b/servers/physics_2d/collision_solver_2d_sw.cpp @@ -203,14 +203,14 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A,const Transfo cinfo.aabb_tests=0; Transform2D rel_transform = p_transform_A; - rel_transform.translate(-p_transform_B.get_origin()); + rel_transform.elements[2]-=p_transform_B.get_origin(); //quickly compute a local Rect2 Rect2 local_aabb; for(int i=0;i<2;i++) { - Vector2 axis( p_transform_B.get_axis(i) ); + Vector2 axis( p_transform_B.elements[i] ); float axis_scale = 1.0/axis.length(); axis*=axis_scale; diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h index 9160d064ef..07a9d84ec8 100644 --- a/servers/physics_2d/shape_2d_sw.h +++ b/servers/physics_2d/shape_2d_sw.h @@ -150,7 +150,7 @@ _FORCE_INLINE_ void project_range_cast(const Vector2& p_cast, const Vector2& p_n real_t mina,maxa;\ real_t minb,maxb;\ Transform2D ofsb=p_transform;\ - ofsb.translate(p_cast);\ + ofsb.elements[2]+=p_cast;\ project_range(p_normal,p_transform,mina,maxa);\ project_range(p_normal,ofsb,minb,maxb); \ r_min=MIN(mina,minb);\ diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index e95707f135..a48b6d3827 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -714,7 +714,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co break; } - body_transform.translate(recover_motion); + body_transform.elements[2]+=recover_motion; body_aabb.pos+=recover_motion; recover_attempts--; @@ -863,7 +863,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co //it collided, let's get the rest info in unsafe advance Transform2D ugt = body_transform; - ugt.translate(p_motion*unsafe); + ugt.elements[2]+=p_motion*unsafe; _RestCallbackData2D rcd; rcd.best_len=0; |