@@ -105,10 +105,6 @@ SpxRaycastInfo SpxPhysicMgr::_raycast(GdVec2 from, GdVec2 to,GdArray ignore_spri
105105 info.normal = GdVec2{0 , 0 };
106106 info.sprite_gid = 0 ;
107107
108- // invert y
109- GdVec2 current_from = GdVec2{from.x , -from.y };
110- GdVec2 target_to = GdVec2{to.x , -to.y };
111-
112108 HashSet<RID> ignore_set;
113109 if (ignore_sprites && ignore_sprites->size > 0 ){
114110 GdObj* sprite_data = (SpxBaseMgr::get_array<GdObj>(ignore_sprites, 0 ));
@@ -126,8 +122,8 @@ SpxRaycastInfo SpxPhysicMgr::_raycast(GdVec2 from, GdVec2 to,GdArray ignore_spri
126122 }
127123 PhysicsDirectSpaceState2D::RayResult result;
128124 PhysicsDirectSpaceState2D::RayParameters params;
129- params.from = current_from ;
130- params.to = target_to ;
125+ params.from = from ;
126+ params.to = to ;
131127 params.collision_mask = (uint32_t )collision_mask;
132128 params.collide_with_areas = collide_with_areas;
133129 params.collide_with_bodies = collide_with_bodies;
@@ -146,8 +142,8 @@ SpxRaycastInfo SpxPhysicMgr::_raycast(GdVec2 from, GdVec2 to,GdArray ignore_spri
146142 SpxSprite *collider = dynamic_cast <SpxSprite *>(result.collider );
147143 GdObj current_gid = collider ? collider->get_gid () : 0 ;
148144 info.collide = true ;
149- info.position = GdVec2{ result.position . x , -result. position . y } ;
150- info.normal = GdVec2{ result.normal . x , -result. normal . y } ;
145+ info.position = result.position ;
146+ info.normal = result.normal ;
151147 info.sprite_gid = current_gid;
152148 return info;
153149}
@@ -165,9 +161,6 @@ GdObj SpxPhysicMgr::raycast(GdVec2 from, GdVec2 to, GdInt collision_mask) {
165161
166162 PhysicsDirectSpaceState2D::RayResult result;
167163 PhysicsDirectSpaceState2D::RayParameters params;
168- // flip y axis
169- from = GdVec2{ from.x , -from.y };
170- to = GdVec2{ to.x , -to.y };
171164 params.from = from;
172165 params.to = to;
173166 params.collision_mask = (uint32_t )collision_mask;
@@ -186,10 +179,6 @@ GdBool SpxPhysicMgr::check_collision(GdVec2 from, GdVec2 to, GdInt collision_mas
186179 PhysicsDirectSpaceState2D *space_state = node->get_world_2d ()->get_direct_space_state ();
187180 PhysicsDirectSpaceState2D::RayResult result;
188181 PhysicsDirectSpaceState2D::RayParameters params;
189-
190- // flip y axis
191- from = GdVec2{ from.x , -from.y };
192- to = GdVec2{ to.x , -to.y };
193182 params.from = from;
194183 params.to = to;
195184 params.collision_mask = (uint32_t )collision_mask;
@@ -297,8 +286,7 @@ GdArray SpxPhysicMgr::_check_collision(RID shape, GdVec2 pos, GdInt collision_ma
297286 return create_array (GD_ARRAY_TYPE_GDOBJ, 0 );
298287 }
299288
300- GdVec2 flipped_pos = GdVec2{ pos.x , -pos.y };
301- Transform2D query_transform (0 , flipped_pos);
289+ Transform2D query_transform (0 , pos);
302290
303291 PhysicsDirectSpaceState2D::ShapeParameters params;
304292 params.shape_rid = shape;
0 commit comments