Skip to content

Commit abacf0d

Browse files
committed
Merge pull request godotengine#107263 from smix8/capsule_outline
Fix CapsuleShape2D outline for navmesh baking
2 parents 151db00 + 58c11e5 commit abacf0d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scene/2d/physics/static_body_2d.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ void StaticBody2D::navmesh_parse_source_geometry(const Ref<NavigationPolygon> &p
163163
shape_outline.resize(14);
164164
int shape_outline_inx = 0;
165165
for (int i = 0; i < 12; i++) {
166-
Vector2 ofs = Vector2(0, (i > 3 && i <= 9) ? -capsule_height * 0.5 + capsule_radius : capsule_height * 0.5 - capsule_radius);
166+
Vector2 ofs = Vector2(0, (i > 3 && i <= 9) ? capsule_height * 0.5 - capsule_radius : -capsule_height * 0.5 + capsule_radius);
167167

168-
shape_outline.write[shape_outline_inx] = static_body_xform.xform(Vector2(Math::sin(i * turn_step), Math::cos(i * turn_step)) * capsule_radius + ofs);
168+
shape_outline.write[shape_outline_inx] = static_body_xform.xform(Vector2(Math::sin(i * turn_step), -Math::cos(i * turn_step)) * capsule_radius + ofs);
169169
shape_outline_inx += 1;
170170
if (i == 3 || i == 9) {
171-
shape_outline.write[shape_outline_inx] = static_body_xform.xform(Vector2(Math::sin(i * turn_step), Math::cos(i * turn_step)) * capsule_radius - ofs);
171+
shape_outline.write[shape_outline_inx] = static_body_xform.xform(Vector2(Math::sin(i * turn_step), -Math::cos(i * turn_step)) * capsule_radius - ofs);
172172
shape_outline_inx += 1;
173173
}
174174
}

0 commit comments

Comments
 (0)