godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.57k stars 20.35k forks source link

ConcavePolygonShape2D Set segments not working #63414

Open flou-ainan opened 2 years ago

flou-ainan commented 2 years ago

Godot version

v3.4.4.stable.official[419e713a2]

System information

Linuxmint 20.3 una | GLES3 & GLES2 | Intel HD Graphics 3000

Issue description

When I add a ConcavePolygonShape2D to a ColisionShape2d and try to edit the number of segments it will not add and the engine throws this error on Console:

servers/physics_2d/shape_2d_sw.cpp:845 - Condition "len % 2" is true.

godotenginebug

I've tried to set the segments via gdscript too and it didn't work either. (worked with convex polygon shape 2d)

godotenginebug2

Steps to reproduce

1 - Create a CollisionShape2D child of a KinematicBody2D or Area2D 2 - Add new ConcavePolygonShape to it 3 - Try to increase the size of the segments on Shape Properties in the Editor Inspector

godotenginebug3

Minimal reproduction project

Katon-Klitgh-GodotProject.zip

lawnjelly commented 2 years ago

The error is being triggered because it seems to only allows a number of points that is even. Perhaps the segments must be pairs of points? I don't know if you can type in the size manually in the box. Or maybe it will start working when the number selected is even.

Even if so, this isn't ideal UI.

flou-ainan commented 2 years ago

The error is being triggered because it seems to only allows a number of points that is even. Perhaps the segments must be pairs of points? I don't know if you can type in the size manually in the box. Or maybe it will start working when the number selected is even.

Even if so, this isn't ideal UI.

I haven't tried using an even number of points, I'm going to try it and give feedback

Marenz commented 1 year ago

related: https://github.com/godotengine/godot/issues/19353

lgrammer commented 1 day ago

This can probably be closed alongside that related as the error is specific segments missing a point during the iteration of the points. This means for the other issue when they are dynamically resizing they are hitting odd values.

Just for archiving this for others who run into the same issue...

The below works as a value for the SetSegments(Vector2[]) :

// 8 total Vector2[] squareSegments = new Vector2[] { new Vector2(-100f, 100f),
new Vector2(100f, 100f),
new Vector2(100f, 100f),
new Vector2(100f, -100f),
new Vector2(100f, -100f),
new Vector2(-100f, -100f), new Vector2(-100f, -100f), new Vector2(-100f, 100f)
};

//7 total Vector2[] squareSegments = new Vector2[] { new Vector2(-100f, 100f),
new Vector2(100f, 100f),
new Vector2(100f, 100f),
new Vector2(100f, -100f),
new Vector2(100f, -100f),
new Vector2(-100f, -100f), new Vector2(-100f, -100f), // removed new Vector2(-100f, 100f) will replicate this error };

It looks like this specific issue will be closed out soon as well.

lawnjelly commented 1 day ago

This can probably be closed alongside that related as the error is specific segments missing a point during the iteration of the points. This means for the other issue when they are dynamically resizing they are hitting odd values.

This may be a misunderstanding of how we use issues.

This one is currently tracking something that is confusing to users - and it hasn't been fixed or addressed, so we tend to leave open.

The PR you link is 5 years old, and it was decided not to go ahead (I've just closed it).

lgrammer commented 21 hours ago

`The PR you link is 5 years old, and it was decided not to go ahead (I've just closed it).

I knew it'd be closed out soon since it was five years old, thanks lawnjelly!

This may be a misunderstanding of how we use issues.

Oops my mistake. In other repos suggestions to close something out that's old and from user related errors isn't really frowned upon. Especially if related PRs are closed out or nearing completion. Can you point me to where I can get more information on comment rules so I don't make a mistake like this in the future? Apologies for the misunderstanding.

lawnjelly commented 15 hours ago

Err we have some guidelines here I've found: https://docs.godotengine.org/en/latest/contributing/workflow/bug_triage_guidelines.html

But mainly this is done by the bugsquad https://github.com/orgs/godotengine/teams/bugsquad which is made up of maintainers, and we normally keep ourselves informed internally. Partly the reason that triage is left to maintainers is that it is very subtle with no hard rules, and often requires detailed knowledge of the team area (people who have been working on area for years).

There's generally little need to worry about triage as a regular contributor, if you see an issue that really obviously should be closed it's fine to flag it to bugsquad (probably on rocketchat rather than the issue if you aren't sure, as there as a danger of leading an issue off topic as is the case here).

There are periodic purges of super old issues / PRs that are no longer relevant afaik.

lgrammer commented 15 hours ago

There's generally little need to worry about triage as a regular contributor, if you see an issue that really obviously should be closed it's fine to flag it to bugsquad (probably on rocketchat rather than the issue if you aren't sure, as there as a danger of leading an issue off topic as is the case here).

Gotcha. I suppose it slipped my mind that Godot is an org with employees that might handle things such as triage and not strictly just open-source contributors. I'll make sure to use rocketchat for stuff like that if I ever find myself actively contributing. Thanks for the information, take care!